Part Number Hot Search : 
ARD5002 EM8510 30009 2N333 MB89P 106K0 NNSW208C AN921
Product Description
Full Text Search
 

To Download MC68332ACFC16 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  order this document by mc68332ts/d rev. 2 ?motorola inc., 1993, 1996 this document contains information on a new product. speci?ations and information herein are subject to change without notice. mc68332 technical summary 32-bit modular microcontroller 1 introduction the mc68332, a highly-integrated 32-bit microcontroller, combines high-performance data manipula- tion capabilities with powerful peripheral subsystems. the mcu is built up from standard modules that interface through a common intermodule bus (imb). standardization facilitates rapid development of devices tailored for specific applications. the mcu incorporates a 32-bit cpu (cpu32), a system integration module (sim), a time processor unit (tpu), a queued serial module (qsm), and a 2-kbyte static ram module with tpu emulation capability (tpuram). the mcu can either synthesize an internal clock signal from an external reference or use an external clock input directly. operation with a 32.768-khz reference frequency is standard. the maximum sys- tem clock speed is 20.97 mhz. system hardware and software allow changes in clock rate during op- eration. because mcu operation is fully static, register and memory contents are not affected by clock rate changes. high-density complementary metal-oxide semiconductor (hcmos) architecture makes the basic power consumption of the mcu low. power consumption can be minimized by stopping the system clock. the cpu32 instruction set includes a low-power stop (lpstop) command that efficiently implements this capability. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68332 2 mc68332ts/d table 1 ordering information package type tpu type temperature frequency (mhz) package order quantity order number 132-pin pqfp motion control e40 to +85 c 16 mhz 2 pc tray spakmc332gcfc16 36 pc tray mc68332gcfc16 20 mhz 2 pc tray spakmc332gcfc20 36 pc tray mc68332gcfc20 e40 to +105 c 16 mhz 2 pc tray spakmc332gvfc16 36 pc tray mc68332gvfc16 20 mhz 2 pc tray spakmc332gvfc20 36 pc tray mc68332gvfc20 e40 to +125 c 16 mhz 2 pc tray spakmc332gmfc16 36 pc tray mc68332gmfc16 20 mhz 2 pc tray spakmc332gmfc20 36 pc tray mc68332gmfc20 standard e40 to +85 c 16 mhz 2 pc tray spakmc332cfc16 36 pc tray mc68332cfc16 20 mhz 2 pc tray spakmc332cfc20 36 pc tray mc68332cfc20 e40 to +105 c 16 mhz 2 pc tray spakmc332vfc16 36 pc tray mc68332vfc16 20 mhz 2 pc tray spakmc332vfc20 36 pc tray mc68332vfc20 e40 to +125 c 16 mhz 2 pc tray spakmc332mfc16 36 pc tray mc68332mfc16 20 mhz 2 pc tray spakmc332mfc20 36 pc tray mc68332mfc20 std w/enhanced ppwa e40 to +85 c 16 mhz 2 pc tray spakmc332acfc16 36 pc tray MC68332ACFC16 20 mhz 2 pc tray spakmc332acfc20 36 pc tray mc68332acfc20 e40 to +105 c 16 mhz 2 pc tray spakmc332avfc16 36 pc tray mc68332avfc16 20 mhz 2 pc tray spakmc332avfc20 36 pc tray mc68332avfc20 e40 to +125 c 16 mhz 2 pc tray spakmc332amfc16 36 pc tray mc68332amfc16 20 mhz 2 pc tray spakmc332amfc20 36 pc tray mc68332amfc20 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68332 motorola mc68332ts/d 3 144-pin qfp motion control e40 to +85 c 16 mhz 2 pc tray spakmc332gcfv16 44 pc tray mc68332gcfvv16 20 mhz 2 pc tray spakmc332gcfv20 44 pc tray mc68332gcfv20 e40 to +105 c 16 mhz 2 pc tray spakmc332gvfv16 44 pc tray mc68332gvfv16 20 mhz 2 pc tray spakmc332gvfv20 44 pc tray mc68332gvfv20 e40 to +125 c 16 mhz 2 pc tray spakmc332gmfv16 44 pc tray mc68332gmfv16 20 mhz 2 pc tray spakmc332gmfv20 44 pc tray mc68332gmfvv20 standard e40 to +85 c 16 mhz 2 pc tray spakmc332cfv16 44 pc tray mc68332cfv16 20 mhz 2 pc tray spakmc332cfvv20 44 pc tray mc68332cfv20 e40 to +105 c 16 mhz 2 pc tray spakmc332vfv16 44 pc tray mc68332vfv16 20 mhz 2 pc tray spakmc332vfv20 44 pc tray mc68332vfv20 e40 to +125 c 16 mhz 2 pc tray spakmc332mfv16 44 pc tray mc68332mfv16 20 mhz 2 pc tray spakmc332mfv20 44 pc tray mc68332mfv20 std w/enhanced ppwa e40 to +85 c 16 mhz 2 pc tray spakmc332acfv16 44 pc tray mc68332acfv16 20 mhz 2 pc tray spakmc332acfv20 44 pc tray mc68332acfv20 e40 to +105 c 16 mhz 2 pc tray spakmc332avfv16 44 pc tray mc68332avfv16 20 mhz 2 pc tray spakmc332avfc20 44 pc tray mc68332avfv20 e40 to +125 c 16 mhz 2 pc tray spakmc332amfv16 44 pc tray mc68332amfv16 20 mhz 2 pc tray spakmc332amfv20 44 pc tray mc68332amfv20 table 1 ordering information (continued) package type tpu type temperature frequency (mhz) package order quantity order number f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
section page table of contents motorola mc68332 4 mc68332ts/d 1 introduction 1 1.1 features ...................................................................................................................................... 5 1.2 block diagram ............................................................................................................................. 6 1.3 pin assignments .......................................................................................................................... 7 1.4 address map ............................................................................................................................... 9 1.5 intermodule bus .......................................................................................................................... 9 2 signal descriptions 10 2.1 pin characteristics .................................................................................................................... 10 2.2 mcu power connections .......................................................................................................... 11 2.3 mcu driver types ..................................................................................................................... 11 2.4 signal characteristics ................................................................................................................ 12 2.5 signal function .......................................................................................................................... 13 3 system integration module 15 3.1 overview ................................................................................................................................... 15 3.2 system configuration and protection ........................................................................................ 17 3.3 system clock ............................................................................................................................ 23 3.4 external bus interface ............................................................................................................... 26 3.5 chip selects .............................................................................................................................. 29 3.6 general-purpose input/output .................................................................................................. 36 3.7 resets ....................................................................................................................................... 38 3.8 interrupts ................................................................................................................................... 41 3.9 factory test block ..................................................................................................................... 43 4 central processor unit 44 4.1 overview ................................................................................................................................... 44 4.2 programming model .................................................................................................................. 44 4.3 status register .......................................................................................................................... 46 4.4 data types ................................................................................................................................ 46 4.5 addressing modes ..................................................................................................................... 46 4.6 instruction set summary ........................................................................................................... 47 4.7 background debugging mode ................................................................................................... 51 5 time processor unit 52 5.1 mc68332 and mc68332a time functions ............................................................................... 52 5.2 mc68332g time functions ...................................................................................................... 55 5.3 programmer's model ................................................................................................................. 57 5.4 parameter ram ......................................................................................................................... 58 5.5 tpu registers ........................................................................................................................... 58 6 queued serial module 64 6.1 overview ................................................................................................................................... 64 6.2 address map ............................................................................................................................. 65 6.3 pin function .............................................................................................................................. 66 6.4 qsm registers .......................................................................................................................... 66 6.5 qspi submodule ....................................................................................................................... 71 6.6 sci submodule ......................................................................................................................... 79 7 standby ram with tpu emulation ram 84 7.1 overview ................................................................................................................................... 84 7.2 tpuram register block ........................................................................................................... 84 7.3 tpuram registers ................................................................................................................... 84 7.4 tpuram operation .................................................................................................................. 85 8 summary of changes 86 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68332 motorola mc68332ts/d 5 1.1 features central processing unit (cpu32) ? 32-bit architecture ? virtual memory implementation ? table lookup and interpolate instruction ? improved exception handling for controller applications ? high-level language support ? background debugging mode ? fully static operation system integration module (sim) ? external bus support ? programmable chip-select outputs ? system protection logic ? watchdog timer, clock monitor, and bus monitor ? two 8-bit dual function input/output ports ? one 7-bit dual function output port ? phase-locked loop (pll) clock system time processor unit (tpu) ? dedicated microengine operating independently of cpu32 ? 16 independent, programmable channels and pins ? any channel can perform any time function ? two timer count registers with programmable prescalers ? selectable channel priority levels queued serial module (qsm) ? enhanced serial communication interface ? queued serial peripheral interface ? one 8-bit dual function port static ram module with tpu emulation capability (tpuram) ? 2-kbytes of static ram ? may be used as normal ram or tpu microcode emulation ram f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68332 6 mc68332ts/d 1.2 block diagram figure 1 mcu block diagram 332 block qs5/pcs2 pqs7/txd pqs4/pcs1 pqs6/pcs3 cpu 32 qsm imb tpu pqs0/miso pqs1/mosi pqs2/sck port qs txd pcs2 sck miso mosi control pcs1 pqs3/pcs0/ss pcs0/ss rxd pcs3 bkpt /dsclk ifetch /dsi ipipe /dso dsi dso ipipe ifetch bkpt irq [7:1 ] addr[23:0] control port f port c fc2 fc1 fc0 bg br bgack modclk addr[23:19] clock ebi cs [10:0 ] br /cs0 bg /cs1 bgack /cs2 r/w reset halt berr clkout xtal extal chip selects csboot addr[18:0] data[15:0] data[15:0] quot test freeze/quot tsc control tsc pc0/fc0/cs3 pc1/fc1/cs4 pc2/fc2/cs5 pc3/addr19/cs6 pc4/addr20/cs7 pc5/addr21/cs8 pc6/addr22/cs9 addr23/cs10 pf7/irq7 pf6/irq6 pf5/irq5 pf4/irq4 pf3/irq3 pf2/irq2 pf1/irq1 pf0/modclk control port e siz1 pe7/siz1 siz0 pe6/siz0 dsack0 pe0/dsack0 dsack1 pe1/dsack1 avec pe2/avec pe3/rmc ds pe5/ds rmc pe4/as t2clk t2clk tpuch[15:0] tpuch[15:0] xfc v ddsyn 2 kbytes ram v stby control as control dsclk freeze f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68332 motorola mc68332ts/d 7 1.3 pin assignments figure 2 mc68332 132-pin qfp pin assignments 332 132-pin qfp mc68332 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 116 115 114 113 112 111 110 109 108 107 106 105 104 103 102 101 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 data9 data10 data11 data12 data13 data14 data15 addr0 addr1 addr2 addr3 addr4 addr5 addr6 addr7 addr8 addr9 addr10 addr11 addr12 addr13 addr14 addr15 addr16 addr17 addr18 pqs0/miso pqs1/mosi pqs2/sck pqs3/pcs0/ss pqs4/pcs1 pqs5/pcs2 pqs6/pcs3 data0 data1 data2 data3 data4 data5 data6 data7 data8 v dd v ss v dd pe1/dsack1 pe0/dsack0 pe2/avec pe3/rmc pe5/ds csboot bgack /cs2 bg /cs1 br /cs0 v stby 51 17 117 16 15 14 13 12 11 10 9 8 7 6 5 4 3 131 130 129 128 127 126 125 124 123 122 121 120 119 118 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 pqs7/txd rxd ipipe /dso freeze/quot xtal extal xfc clkout pf0/modclk pe7/siz1 pe6/siz0 tpuch0 tpuch1 tpuch2 tpuch3 tpuch4 tpuch5 tpuch6 tpuch7 tpuch8 tpuch9 tpuch10 tpuch11 tpuch13 tpuch14 tpuch15 t2clk tpuch12 v ss v dd v ss pc0/fc0/cs3 pc1/fc1/cs4 pc2/fc2/cs5 pc3/addr19/cs6 pc4/addr20/cs7 pc5/addr21/cs8 pc6/addr22/cs9 addr23/cs10 as r/w pf1/irq1 pf2/irq2 pf3/irq3 pf4/irq4 pf5/irq5 pf6/irq6 pf7/irq7 berr halt reset tsc bkpt /dsclk ifetch /dsi 2 1 132 v ddsyn v ss v ss v dd v ss v dd v ss v dd v ss v ss v dd v dd v ss v dd v dd v ss v ss v dd v ss v ss v ss v dd v dd f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68332 8 mc68332ts/d figure 3 mc68332 144-pin qfp pin assignments 332 144-pin qfp v ss nc fc0/cs3 fc1/cs4 fc2/cs5 addr19/cs6 addr20/cs7 addr21/cs8 addr22/cs9 addr23/cs10 v dd t2clk tpuch15 tpuch14 tpuch13 tpuch12 nc tpuch11 tpuch10 tpuch9 tpuch8 v dde v sse tpuch7 tpuch6 tpuch5 tpuch4 mc68332 nc pe4/as pe6/siz0 pe7/siz1 r/w pf0/modclk pf1/irq1 pf2/irq2 pf3/irq3 pf4/irq4 pf5/irq5 pf6/irq6 pf7/irq7 berr halt reset clkout nc xfc extal v dd xtal freeze/quot tsc bkpt /dsclk ifetch /dsi ipipe /dso rxd pqs7/txd v ss nc tpuch3 tpuch2 tpuch1 tpuch0 nc 2 1 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 107 108 106 105 104 103 102 101 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74 73 31 32 33 34 35 36 bgack /cs2 bg/cs1 br/cs0 csboot data0 data1 data2 data3 data4 data5 data6 data7 nc data8 nc data9 data10 nc data11 v ss data12 data13 data14 data15 addr0 pe0/dsack0 pe1/dsack1 pe2/avec pe3/rmc pe5/ds v dd v stby addr1 addr2 addr3 addr4 addr5 addr6 addr7 addr8 v dd v ss addr9 addr10 addr11 addr12 nc nc addr13 addr14 addr15 nc addr16 addr17 addr18 pqs0/miso pqs1/mosi pqs2/sck pqs3/pcs0/ss pqs4/pcs1 pqs5/pcs2 pqs6/pcs3 143 144 142 141 140 139 138 137 136 135 134 133 132 131 130 129 128 127 126 125 124 123 122 121 120 119 118 117 116 115 114 113 112 111 110 109 37 65 68 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 66 67 69 70 71 72 v ss v dd v ss v dd v ss v dd v dd v ss v ss v dd v ss v ss v dd v dd v ss v dd v ss v ss v dd f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68332 motorola mc68332ts/d 9 1.4 address map the following figure is a map of the mcu internal addresses. the ram array is positioned by the base address registers in the associated ram control block. unimplemented blocks are mapped externally. figure 4 mcu address map 1.5 intermodule bus the intermodule bus (imb) is a standardized bus developed to facilitate both design and operation of modular microcontrollers. it contains circuitry to support exception processing, address space partition- ing, multiple interrupt levels, and vectored interrupts. the standardized modules in the mcu communi- cate with one another and with external components through the imb. the imb in the mcu uses 24 address and 16 data lines. 332 address map sim reserved qsm $yffc00 $yffb40 $yff000 2-kbyte tpuram array $yffa00 tpuram control $yffb00 reserved $yffa80 tpu $yfffff $yffe00 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68332 10 mc68332ts/d 2 signal descriptions 2.1 pin characteristics the following table shows mcu pins and their characteristics. all inputs detect cmos logic levels. all inputs can be put in a high-impedance state, but the method of doing this differs depending upon pin function. refer to the table, mcu driver types, for a description of output drivers. an entry in the dis- crete i/o column of the mcu pin characteristics table indicates that a pin has an alternate i/o function. the port designation is given when it applies. refer to the mcu block diagram for information about port organization. table 2 mcu pin characteristic pin mnemonic output driver input synchronized input hysteresis discrete i/o port designation addr23/cs10 /eclk a y n o ? addr[22:19]/cs[9:6] a y n o pc[6:3] addr[18:0] a y n ? ? as b y n i/o pe5 avec b y n i/o pe2 berr by n ? ? bg /cs1 b ? ? ? ? bgack /cs2 b y n ? ? bkpt /dsclk ? y y ? ? br /cs0 by n ?? clkout a ? ? ? ? csboot b ? ? ? ? data[15:0] 1 aw y n ? ? ds b y n i/o pe4 dsack1 b y n i/o pe1 dsack0 b y n i/o pe0 dsi/ifetch ay y ?? dso/ipipe a? ? ?? extal 2 ? ? special ? ? fc[2:0]/cs[5:3] a y n o pc[2:0] freeze/quot a ? ? ? ? halt bo y n ? ? irq[7:1] b y y i/o pf[7:1] miso bo y y i/o pqs0 modclk 1 b y n i/o pf0 mosi bo y y i/o pqs1 pcs0/ss bo y y i/o pqs3 pcs[3:1] bo y y i/o pqs[6:4] r/w ay n ? ? reset bo y y ? ? rmc b y n i/o pe3 rxd ? n n ? ? sck bo y y i/o pqs2 siz[1:0] b y n i/o pe[7:6] f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68332 motorola mc68332ts/d 11 notes: 1. data[15:0] are synchronized during reset only. modclk is synchronized only when used as an input port pin. 2. extal, xfc, and xtal are clock reference connections. 2.2 mcu power connections 2.3 mcu driver types t2clk ? y y ? ? tpuch[15:0] a y y ? ? tsc ? y y ? ? txd bo y y i/o pqs7 xfc 2 ? ? ? special ? xtal 2 ? ? ? special ? table 3 mcu power connections v stby standby ram power/clock synthesizer power v ddsyn clock synthesizer power v sse /v dde external periphery power (source and drain) v ssi /v ddi internal module power (source and drain) table 4 mcu driver types type i/o description a o output-only signals that are always driven; no external pull-up required aw o type a output with weak p-channel pull-up during reset b o three-state output that includes circuitry to pull up output before high impedance is established, to ensure rapid rise time. an external holding resistor is required to maintain logic level while the pin is in the high-impedance state. bo o type b output that can be operated in an open-drain mode table 2 mcu pin characteristic (continued) pin mnemonic output driver input synchronized input hysteresis discrete i/o port designation f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68332 12 mc68332ts/d 2.4 signal characteristics table 5 mcu signal characteristics signal name mcu module signal type active state addr[23:0] sim bus ? as sim output 0 avec sim input 0 berr sim input 0 bg sim output 0 bgack sim input 0 bkpt cpu32 input 0 br sim input 0 clkout sim output ? cs[10:0] sim output 0 csboot sim output 0 data[15:0] sim bus ? ds sim output 0 dsack[1:0] sim input 0 dsclk cpu32 input serial clock dsi cpu32 input (serial data) dso cpu32 output (serial data) extal sim input ? fc[2:0] sim output ? freeze sim output 1 halt sim input/output 0 ifetch cpu32 output ? ipipe cpu32 output ? irq[7:1] sim input 0 miso qsm input/output ? modclk sim input ? mosi qsm input/output ? pc[6:0] sim output (port) pcs[3:0] qsm input/output ? pe[7:0] sim input/output (port) pf[7:0] sim input/output (port) pqs[7:0] qsm input/output (port) quot sim output ? reset sim input/output 0 rmc sim output 0 r/w sim output 1/0 rxd qsm input ? sck qsm input/output ? siz[1:0] sim output ? ss qsm input 0 t2clk tpu input ? tpuch[15:0] tpu input/output 1 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68332 motorola mc68332ts/d 13 2.5 signal function tsc sim input ? txd qsm output ? xfc sim input ? xtal sim output ? table 6 mcu signal function signal name mnemonic function address bus addr[23:0] 24-bit address bus address strobe as indicates that a valid address is on the address bus autovector avec requests an automatic vector during interrupt acknowledge bus error berr indicates that a bus error has occurred bus grant bg indicates that the mcu has relinquished the bus bus grant acknowledge bgack indicates that an external device has assumed bus mastership breakpoint bkpt signals a hardware breakpoint to the cpu bus request br indicates that an external device requires bus mastership system clockout clkout system clock output chip selects cs[10:0] select external devices at programmed addresses boot chip select csboot chip select for external boot start-up rom data bus data[15:0] 16-bit data bus data strobe ds during a read cycle, indicates when it is possible for an external device to place data on the data bus. during a write cycle, indi- cates that valid data is on the data bus. data and size acknowledge dsack[1:0] provide asynchronous data transfers and dynamic bus sizing development serial in, out, clock dsi, dso, dsclk serial i/o and clock for background debugging mode crystal oscillator extal, xtal connections for clock synthesizer circuit reference; a crystal or an external oscillator can be used function codes fc[2:0] identify processor state and current address space freeze freeze indicates that the cpu has entered background mode halt halt suspend external bus activity instruction pipeline ifetch ipipe indicate instruction pipeline activity interrupt request level irq[7:1] provides an interrupt priority level to the cpu master in slave out miso serial input to qspi in master mode; serial output from qspi in slave mode clock mode select modclk selects the source and type of system clock master out slave in mosi serial output from qspi in master mode; serial input to qspi in slave mode port c pc[6:0] sim digital output port signals peripheral chip select pcs[3:0] qspi peripheral chip selects port e pe[7:0] sim digital i/o port signals port f pf[7:0] sim digital i/o port signals port qs pqs[7:0] qsm digital i/o port signals table 5 mcu signal characteristics (continued) signal name mcu module signal type active state f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68332 14 mc68332ts/d quotient out quot provides the quotient bit of the polynomial divider reset reset system reset read-modify-write cycle rmc indicates an indivisible read-modify-write instruction read/write r/w indicates the direction of data transfer on the bus sci receive data rxd serial input to the sci qspi serial clock sck clock output from qspi in master mode; clock input to qspi in slave mode size siz[1:0] indicates the number of bytes to be transferred during a bus cycle slave select ss causes serial transmission when qspi is in slave mode; causes mode fault in master mode tcr2 clock t2clk external clock source for tcr2 counter tpu channel pins tpuch[15:0] bidirectional pins associated with tpu channels three-state control tsc places all output drivers in a high-impedance state sci transmit data txd serial output from the sci external filter capacitor xfc connection for external phase-locked loop filter capacitor table 6 mcu signal function (continued) signal name mnemonic function f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68332 motorola mc68332ts/d 15 3 system integration module the mcu system integration module (sim) consists of five functional blocks that control system start- up, initialization, configuration, and external bus. figure 5 sim block diagram 3.1 overview the system configuration and protection block controls mcu configuration and operating mode. the block also provides bus and software watchdog monitors. the system clock generates clock signals used by the sim, other imb modules, and external devices. in addition, a periodic interrupt generator supports execution of time-critical control routines. the external bus interface handles the transfer of information between imb modules and external ad- dress space. the chip-select block provides eleven general-purpose chip-select signals and a boot rom chip select signal. both general-purpose and boot rom chip-select signals have associated base address regis- ters and option registers. the system test block incorporates hardware necessary for testing the mcu. it is used to perform fac- tory tests, and its use in normal applications is not supported. the sim control register address map occupies 128 bytes. unused registers within the 128-byte ad- dress space return zeros when read. the access column in the sim address map below indicates which registers are accessible only at the supervisor privilege level and which can be assigned to either the supervisor or user privilege level, according to the value of the supv bit in the simcr. s(c)im block system configuration and protection clock synthesizer chip selects external bus interface factory test clkout extal modclk chip selects external bus reset tsc freeze/quot f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68332 16 mc68332ts/d table 7 sim address map access address 15 8 7 0 s $yffa00 sim configuration (simcr) s $yffa02 factory test (simtr) s $yffa04 clock synthesizer control (syncr) s $yffa06 not used reset status register (rsr) s $yffa08 module test e (simtre) s $yffa0a not used not used s $yffa0c not used not used s $yffa0e not used not used s/u $yffa10 not used port e data (porte0) s/u $yffa12 not used port e data (porte1) s/u $yffa14 not used port e data direction (ddre) s $yffa16 not used port e pin assignment (pepar) s/u $yffa18 not used port f data (portf0) s/u $yffa1a not used port f data (portf1) s/u $yffa1c not used port f data direction (ddrf) s $yffa1e not used port f pin assignment (pfpar) s $yffa20 not used system protection control (sypcr) s $yffa22 periodic interrupt control (picr) s $yffa24 periodic interrupt timing (pitr) s $yffa26 not used software service (swsr) s $yffa28 not used not used s $yffa2a not used not used s $yffa2c not used not used s $yffa2e not used not used s $yffa30 test module master shift a (tstmsra) s $yffa32 test module master shift b (tstmsrb) s $yffa34 test module shift count (tstsc) s $yffa36 test module repetition counter (tstrc) s $yffa38 test module control (creg) s/u $yffa3a test module distributed register (dreg) $yffa3c not used not used $yffa3e not used not used s/u $yffa40 not used port c data (portc) $yffa42 not used not used s $yffa44 chip-select pin assignment (cspar0) s $yffa46 chip-select pin assignment (cspar1) s $yffa48 chip-select base boot (csbarbt) s $yffa4a chip-select option boot (csorbt) s $yffa4c chip-select base 0 (csbar0) s $yffa4e chip-select option 0 (csor0) s $yffa50 chip-select base 1 (csbar1) s $yffa52 chip-select option 1 (csor1) s $yffa54 chip-select base 2 (csbar2) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68332 motorola mc68332ts/d 17 y = m111, where m is the logic state of the module mapping (mm) bit in the simcr. 3.2 system configuration and protection this functional block provides configuration control for the entire mcu. it also performs interrupt arbi- tration, bus monitoring, and system test functions. mcu system protection includes a bus monitor, a halt monitor, a spurious interrupt monitor, and a software watchdog timer. these functions have been made integral to the microcontroller to reduce the number of external components in a complete control system. s $yffa56 chip-select option 2 (csor2) s $yffa58 chip-select base 3 (csbar3) s $yffa5a chip-select option 3 (csor3) s $yffa5c chip-select base 4 (csbar4) s $yffa5e chip-select option 4 (csor4) s $yffa60 chip-select base 5 (csbar5) s $yffa62 chip-select option 5 (csor5) s $yffa64 chip-select base 6 (csbar6) s $yffa66 chip-select option 6 (csor6) s $yffa68 chip-select base 7 (csbar7) s $yffa6a chip-select option 7 (csor7) s $yffa6c chip-select base 8 (csbar8) s $yffa6e chip-select option 8 (csor8) s $yffa70 chip-select base 9 (csbar9) s $yffa72 chip-select option 9 (csor9) s $yffa74 chip-select base 10 (csbar10) s $yffa76 chip-select option 10 (csor10) $yffa78 not used not used $yffa7a not used not used $yffa7c not used not used $yffa7e not used not used table 7 sim address map (continued) access address 15 8 7 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68332 18 mc68332ts/d figure 6 system configuration and protection block 3.2.1 system configuration the sim controls mcu configuration during normal operation and during internal testing. the sim configuration register controls system configuration. it can be read or written at any time, ex- cept for the module mapping (mm) bit, which can be written only once. simcr ?sim configuration register $yffa00 15 14 13 12 11 10 9 8 7 6 5 4 3 0 exoff frzsw frzbm 0 slven 0 shen supv mm 0 0 iarb reset: 0 0 0 0 data11 0 0 0 1 1 0 0 1 1 1 1 sys protect block module configuration and test reset status halt monitor bus monitor spurious interrupt monitor software watchdog timer periodic interrupt timer prescaler clock berr reset request reset request 2 9 irq [7:1 ] f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68332 motorola mc68332ts/d 19 exoff ? external clock off 0 = the clkout pin is driven from an internal clock source. 1 = the clkout pin is placed in a high-impedance state. frzsw ? freeze software enable 0 = when freeze is asserted, the software watchdog and periodic interrupt timer counters con- tinue to run. 1 = when freeze is asserted, the software watchdog and periodic interrupt timer counters are dis- abled, preventing interrupts during software debug. frzbm ? freeze bus monitor enable 0 = when freeze is asserted, the bus monitor continues to operate. 1 = when freeze is asserted, the bus monitor is disabled. slven ? factory test mode enabled this bit is a read-only status bit that reflects the state of data11 during reset. 0 = imb is not available to an external master. 1 = an external bus master has direct access to the imb. shen[1:0] ? show cycle enable this field determines what the ebi does with the external bus during internal transfer operations. a show cycle allows internal transfers to be externally monitored. the table below shows whether show cycle data is driven externally, and whether external bus arbitration can occur. to prevent bus conflict, external peripherals must not be enabled during show cycles. supv ? supervisor/unrestricted data space the supv bit places the sim global registers in either supervisor or user data space. 0 = registers with access controlled by the supv bit are accessible from either the user or super- visor privilege level. 1 = registers with access controlled by the supv bit are restricted to supervisor access only. mm ? module mapping 0 = internal modules are addressed from $7ff000 e$7fffff. 1 = internal modules are addressed from $fff000 e$ffffff. iarb[3:0] ? interrupt arbitration field each module that can generate interrupt requests has an interrupt arbitration (iarb) field. arbitration between interrupt requests of the same priority is performed by serial contention between iarb field bit values. contention must take place whenever an interrupt request is acknowledged, even when there is only a single pending request. an iarb field must have a non-zero value for contention to take place. if an interrupt request from a module with an iarb field value of %0000 is recognized, the cpu pro- cesses a spurious interrupt exception. because the sim routes external interrupt requests to the cpu, the sim iarb field value is used for arbitration between internal and external interrupts of the same pri- ority. the reset value of iarb for the sim is %1111, and the reset iarb value for all other modules is %0000, which prevents sim interrupts from being discarded during initialization. shen action 00 show cycles disabled, external arbitration enabled 01 show cycles enabled, external arbitration disabled 10 show cycles enabled, external arbitration enabled 11 show cycles enabled, external arbitration enabled, internal activity is halted by a bus grant f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68332 20 mc68332ts/d 3.2.2 system protection control register the system protection control register controls system monitor functions, software watchdog clock prescaling, and bus monitor timing. this register can be written only once following power-on or reset, but can be read at any time. swe ? software watchdog enable 0 = software watchdog disabled 1 = software watchdog enabled swp ? software watchdog prescale this bit controls the value of the software watchdog prescaler. 0 = software watchdog clock not prescaled 1 = software watchdog clock prescaled by 512 swt[1:0] ? software watchdog timing this field selects the divide ratio used to establish software watchdog time-out period. the following ta- ble gives the ratio for each combination of swp and swt bits. hme ? halt monitor enable 0 = disable halt monitor function 1 = enable halt monitor function bme ? bus monitor external enable 0 = disable bus monitor function for an internal to external bus cycle. 1 = enable bus monitor function for an internal to external bus cycle. bmt[1:0] ? bus monitor timing this field selects a bus monitor time-out period as shown in the following table. sypcr ?system protection control register $yffa21 15 8 7 6 5 4 3 2 1 0 not used swe swp swt hme bme bmt reset: 1 modclk 0 0 0 0 0 0 swp swt ratio 000 2 9 001 2 11 010 2 13 011 2 15 100 2 18 101 2 20 110 2 22 111 2 24 bmt bus monitor time-out period 00 64 system clocks 01 32 system clocks 10 16 system clocks 11 8 system clocks f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68332 motorola mc68332ts/d 21 3.2.3 bus monitor the internal bus monitor checks for excessively long dsack response times during normal bus cycles and for excessively long dsack or avec response times during interrupt acknowledge cycles. the monitor asserts berr if response time is excessive. dsack and avec response times are measured in clock cycles. the maximum allowable response time can be selected by setting the bmt field. the monitor does not check dsack response on the external bus unless the cpu initiates the bus cy- cle. the bme bit in the sypcr enables the internal bus monitor for internal to external bus cycles. if a system contains external bus masters, an external bus monitor must be implemented and the internal to external bus monitor option must be disabled. 3.2.4 halt monitor the halt monitor responds to an assertion of halt on the internal bus. a flag in the reset status register (rsr) indicates that the last reset was caused by the halt monitor. the halt monitor reset can be inhib- ited by the hme bit in the sypcr. 3.2.5 spurious interrupt monitor the spurious interrupt monitor issues berr if no interrupt arbitration occurs during an interrupt-ac- knowledge cycle. 3.2.6 software watchdog the software watchdog is controlled by swe in the sypcr. once enabled, the watchdog requires that a service sequence be written to swsr on a periodic basis. if servicing does not take place, the watch- dog times out and issues a reset. this register can be written at any time, but returns zeros when read. register shown with read value perform a software watchdog service sequence as follows: a. write $55 to swsr. b. write $aa to swsr. both writes must occur before time-out in the order listed, but any number of instructions can be exe- cuted between the two writes. the watchdog clock rate is affected by swp and swt in sypcr. when swt[1:0] are modified, a watchdog service sequence must be performed before the new time-out period takes effect. the reset value of swp is affected by the state of the modclk pin on the rising edge of reset, as shown in the following table. swsr ?software service register $yffa27 15 8 7 6 5 4 3 2 1 0 not used 0 0 0 0 0 0 0 0 reset: 0 0 0 0 0 0 0 0 modclk swp 01 10 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68332 22 mc68332ts/d 3.2.7 periodic interrupt timer the periodic interrupt timer (pit) generates interrupts of specified priorities at specified intervals. timing for the pit is provided by a programmable prescaler driven by the system clock. this register contains information concerning periodic interrupt priority and vectoring. bits [10:0] can be read or written at any time. bits [15:11] are unimplemented and always return zero. pirql[2:0] ? periodic interrupt request level the following table shows what interrupt request level is asserted when a periodic interrupt is generat- ed. if a pit interrupt and an external irq signal of the same priority occur simultaneously, the pit in- terrupt is serviced first. the periodic timer continues to run when the interrupt is disabled. piv[7:0] ? periodic interrupt vector the bits of this field contain the vector generated in response to an interrupt from the periodic timer. when the sim responds, the periodic interrupt vector is placed on the bus. the pitr contains the count value for the periodic timer. a zero value turns off the periodic timer. this register can be read or written at any time. ptp ? periodic timer prescaler control 0 = periodic timer clock not prescaled 1 = periodic timer clock prescaled by a value of 512 the reset state of ptp is the complement of the state of the modclk signal during reset. pitm[7:0] ? periodic interrupt timing modulus field this is an 8-bit timing modulus. the period of the timer can be calculated as follows: pit period = [(pitm)(prescaler)(4)]/extal where pit period = periodic interrupt timer period pitm = periodic interrupt timer register modulus (pitr[7:0]) extal frequency = crystal frequency prescale = 512 or 1 depending on the state of the ptp bit in the pitr picr ? periodic interrupt control register $yffa22 15 14 13 12 11 10 8 7 0 0 0 0 0 0 pirql piv reset: 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 pirql interrupt request level 000 periodic interrupt disabled 001 interrupt request level 1 010 interrupt request level 2 011 interrupt request level 3 100 interrupt request level 4 101 interrupt request level 5 110 interrupt request level 6 111 interrupt request level 7 pitr ?eriodic interrupt timer register $yffa24 15 14 13 12 11 10 9 8 7 0 0 0 0 0 0 0 0 ptp pitm reset: 0 0 0 0 0 0 0 modclk 0 0 0 0 0 0 0 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68332 motorola mc68332ts/d 23 3.3 system clock the system clock in the sim provides timing signals for the imb modules and for an external peripheral bus. because mcu operation is fully static, register and memory contents are not affected when the clock rate changes. system hardware and software support changes in the clock rate during operation. the system clock signal can be generated in three ways. an internal phase-locked loop can synthesize the clock from an internal or external frequency source, or the clock signal can be input from an external source. following is a block diagram of the clock submodule. figure 7 system clock block diagram 3.3.1 clock sources the state of the clock mode (modclk) pin during reset determines the clock source. when modclk is held high during reset, the clock synthesizer generates a clock signal from either a crystal oscillator or an external reference input. clock synthesizer control register syncr determines operating frequen- cy and various modes of operation. when modclk is held low during reset, the clock synthesizer is disabled, and an external system clock signal must be applied. when the synthesizer is disabled, syn- cr control bits have no effect. a reference crystal must be connected between the extal and xtal pins to use the internal oscillator. use of a 32.768-khz crystal is recommended. these crystals are inexpensive and readily available. if an external reference signal or an external system clock signal is applied through the extal pin, the xtal pin must be left floating. external reference signal frequency must be less than or equal to max- imum specified reference frequency. external system clock signal frequency must be less than or equal to maximum specified system clock frequency. sys clock block 32khz clkout extal phase comparator low-pass filter vco crystal oscillator system clock system clock control xtal xfc pin v ddsyn xfc 1 0.1 m f .01 m f 0.1 m f feedback divider 22 pf 2 10m 330k 1. must be low-leakage capacitor (insulation resistance 30,000 m w or greater). 2. resistance and capacitance based on a test circuit constructed with a daishinku dmx-38 32.768-khz crystal. specific components must be based on crystal type. contact crystal vendor for exact circuit. w x y v ssi 22 pf 2 v ssi v ssi v ddsyn f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68332 24 mc68332ts/d when an external system clock signal is applied (i.e., the pll is not used), duty cycle of the input is critical, especially at near maximum operating frequencies. the relationship between clock signal duty cycle and clock signal period is expressed: minimum external clock period = minimum external clock high/low time 50% ? percentage variation of external clock input duty cycle 3.3.2 clock synthesizer operation a voltage controlled oscillator (vco) generates the system clock signal. a portion of the clock signal is fed back to a divider/counter. the divider controls the frequency of one input to a phase comparator. the other phase comparator input is a reference signal, either from the internal oscillator or from an external source. the comparator generates a control signal proportional to the difference in phase be- tween its two inputs. the signal is low-pass filtered and used to correct vco output frequency. the synthesizer locks when vco frequency is identical to reference frequency. lock time is affected by the filter time constant and by the amount of difference between the two comparator inputs. whenever comparator input changes, the synthesizer must re-lock. lock status is shown by the slock bit in syn- cr. the mcu does not come out of reset state until the synthesizer locks. crystal type, characteristic fre- quency, and layout of external oscillator circuitry affect lock time. the low-pass filter requires an external low-leakage capacitor, typically 0.1 m f, connected between the xfc and v ddsyn pins. v ddsyn is used to power the clock circuits. a separate power source increases mcu noise immunity and can be used to run the clock when the mcu is powered down. use a quiet power supply as the v ddsyn source, since pll stability depends on the vco, which uses this supply. place adequate ex- ternal bypass capacitors as close as possible to the v ddsyn pin to ensure stable operating frequency. when the clock synthesizer is used, control register syncr determines operating frequency and vari- ous modes of operation. syncr can be read only when the processor is operating at the supervisor privilege level. the syncr x bit controls a divide by two prescaler that is not in the synthesizer feedback loop. setting x doubles clock speed without changing vco speed. there is no vco relock delay. the syncr w bit controls a 3-bit prescaler in the feedback divider. setting w increases vco speed by a factor of four. the syncr y field determines the count modulus for a modulo 64 down counter, causing it to divide by a value of y + 1. when either w or y value changes, there is a vco relock delay. clock frequency is determined by syncr bit settings as follows: f system = f reference [4(y + 1)(2 2w + x )] in order for the device to perform correctly, the clock frequency selected by the w, x, and y bits must be within the limits specified for the mcu. the vco frequency is twice the system clock frequency if x = 1 or four times the system clock frequency if x = 0. the reset state of syncr ($3f00) produces a modulus-64 count. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68332 motorola mc68332ts/d 25 3.3.3 clock control the clock control circuits determine system clock frequency and clock operation under special circum- stances, such as following loss of synthesizer reference or during low-power operation. clock source is determined by the logic state of the modclk pin during reset. when the on-chip clock synthesizer is used, system clock frequency is controlled by the bits in the upper byte of syncr. bits in the lower byte show status of or control operation of internal and external clocks. the syncr can be read or written only when the cpu is operating at the supervisor privilege level. w ? frequency control (vco) this bit controls a prescaler tap in the synthesizer feedback loop. setting the bit increases the vco speed by a factor of four. vco relock delay is required. x ? frequency control bit (prescale) this bit controls a divide by two prescaler that is not in the synthesizer feedback loop. setting the bit doubles clock speed without changing the vco speed. there is no vco relock delay. y[5:0] ? frequency control (counter) the y field controls the modulus down counter in the synthesizer feedback loop, causing it to divide by a value of y + 1. values range from 0 to 63. vco relock delay is required. ediv ? e clock divide rate 0 = eclk frequency is system clock divided by 8. 1 = eclk frequency is system clock divided by 16. eclk is an external m6800 bus clock available on pin addr23. refer to 3.5 chip selects for more information. slimp ? limp mode flag 0 = external crystal is vco reference. 1 = loss of crystal reference. when the on-chip synthesizer is used, loss of reference frequency causes slimp to be set. the vco continues to run using the base control voltage. maximum limp frequency is maximum specified system clock frequency. x-bit state affects limp frequency. slock ? synthesizer lock flag 0 = vco is enabled, but has not locked. 1 = vco has locked on the desired frequency (or system clock is external). the mcu maintains reset state until the synthesizer locks, but slock does not indicate synthesizer lock status until after the user writes to syncr. rsten ? reset enable 0 = loss of crystal causes the mcu to operate in limp mode. 1 = loss of crystal causes system reset. stsim ? stop mode sim clock 0 = when lpstop is executed, the sim clock is driven from the crystal oscillator and the vco is turned off to conserve power. 1 = when lpstop is executed, the sim clock is driven from the vco. stext ? stop mode external clock 0 = when lpstop is executed, the clkout signal is held negated to conserve power. 1 = when lpstop is executed, the clkout signal is driven from the sim clock, as determined by the state of the stsim bit. syncr ?clock synthesizer control register $yffa04 15 14 13 8 7 6 5 4 3 2 1 0 w x y ediv 0 0 slimp slock rsten stsim stext reset: 0 0 1 1 1 1 1 1 0 0 0 u u 0 0 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68332 26 mc68332ts/d 3.4 external bus interface the external bus interface (ebi) transfers information between the internal mcu bus and external de- vices. the external bus has 24 address lines and 16 data lines. the ebi provides dynamic sizing between 8-bit and 16-bit data accesses. it supports byte, word, and long-word transfers. ports are accessed through the use of asynchronous cycles controlled by the data transfer (siz1 and siz0) and data size acknowledge pins (dsack1 and dsack0 ). multiple bus cycles may be required for a transfer to or from an 8-bit port. port width is the maximum number of bits accepted or provided during a bus transfer. external devices must follow the handshake protocol described below. control signals indicate the beginning of the cycle, the address space, the size of the transfer, and the type of cycle. the selected device controls the length of the cycle. strobe signals, one for the address bus and another for the data bus, indicate the validity of an address and provide timing information for data. the ebi operates in an asynchronous mode for any port width. to add flexibility and minimize the necessity for external logic, mcu chip-select logic can be synchro- nized with ebi transfers. chip-select logic can also provide internally-generated bus control signals for these accesses. refer to 3.5 chip selects for more information. 3.4.1 bus control signals the cpu initiates a bus cycle by driving the address, size, function code, and read/write outputs. at the beginning of the cycle, size signals siz0 and siz1 are driven along with the function code signals. the size signals indicate the number of bytes remaining to be transferred during an operand cycle. they are valid while the address strobe (as ) is asserted. the following table shows siz0 and siz1 encoding. the read/write (r/w ) signal determines the direction of the transfer during a bus cycle. this signal changes state, when required, at the beginning of a bus cycle, and is valid while as is asserted. r/w only chang- es state when a write cycle is preceded by a read cycle or vice versa. the signal can remain low for two consecutive write cycles. 3.4.2 function codes the cpu32 automatically generates function code signals fc[2:0]. the function codes can be consid- ered address extensions that automatically select one of eight address spaces to which an address ap- plies. these spaces are designated as either user or supervisor, and program or data spaces. address space 7 is designated cpu space. cpu space is used for control information not normally associated with read or write bus cycles. function codes are valid while as is asserted. table 8 size signal encoding siz1 siz0 transfer size 0 1 byte 1 0 word 1 1 three byte 0 0 long word f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68332 motorola mc68332ts/d 27 3.4.3 address bus address bus signals addr[23:0] define the address of the most significant byte to be transferred during a bus cycle. the mcu places the address on the bus at the beginning of a bus cycle. the address is valid while as is asserted. 3.4.4 address strobe as is a timing signal that indicates the validity of an address on the address bus and the validity of many control signals. it is asserted one-half clock after the beginning of a bus cycle. 3.4.5 data bus data bus signals data[15:0] make up a bidirectional, non-multiplexed parallel bus that transfers data to or from the mcu. a read or write operation can transfer 8 or 16 bits of data in one bus cycle. during a read cycle, the data is latched by the mcu on the last falling edge of the clock for that bus cycle. for a write cycle, all 16 bits of the data bus are driven, regardless of the port width or operand size. the mcu places the data on the data bus one-half clock cycle after as is asserted in a write cycle. 3.4.6 data strobe data strobe (ds ) is a timing signal. for a read cycle, the mcu asserts ds to signal an external device to place data on the bus. ds is asserted at the same time as as during a read cycle. for a write cycle, ds signals an external device that data on the bus is valid. the mcu asserts ds one full clock cycle after the assertion of as during a write cycle. 3.4.7 bus cycle termination signals during bus cycles, external devices assert the data transfer and size acknowledge signals (dsack1 and dsack0 ). during a read cycle, the signals tell the mcu to terminate the bus cycle and to latch data. during a write cycle, the signals indicate that an external device has successfully stored data and that the cycle can end. these signals also indicate to the mcu the size of the port for the bus cycle just com- pleted. (refer to 3.4.9 dynamic bus sizing.) the bus error (berr ) signal is also a bus cycle termination indicator and can be used in the absence of dsack1 and dsack0 to indicate a bus error condition. it can also be asserted in conjunction with these signals, provided it meets the appropriate timing requirements. the internal bus monitor can be used to generate the berr signal for internal and internal-to-external transfers. when berr and halt are asserted simultaneously, the cpu takes a bus error exception. autovector signal (avec ) can terminate external irq pin interrupt acknowledge cycles. avec indicates that the mcu will internally generate a vector number to locate an interrupt handler routine. if it is con- tinuously asserted, autovectors will be generated for all external interrupt requests. avec is ignored during all other bus cycles. table 9 cpu32 address space encoding fc2 fc1 fc0 address space 0 0 0 reserved 0 0 1 user data space 0 1 0 user program space 0 1 1 reserved 1 0 0 reserved 1 0 1 supervisor data space 1 1 0 supervisor program space 1 1 1 cpu space f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68332 28 mc68332ts/d 3.4.8 data transfer mechanism the mcu architecture supports byte, word, and long-word operands, allowing access to 8- and 16-bit data ports through the use of asynchronous cycles controlled by the data transfer and size acknowledge inputs (dsack1 and dsack0 ). 3.4.9 dynamic bus sizing the mcu dynamically interprets the port size of the addressed device during each bus cycle, allowing operand transfers to or from 8- and 16-bit ports. during an operand transfer cycle, the slave device sig- nals its port size and indicates completion of the bus cycle to the mcu through the use of the dsack0 and dsack1 inputs, as shown in the following table. for example, if the mcu is executing an instruction that reads a long-word operand from a 16-bit port, the mcu latches the 16 bits of valid data and then runs another bus cycle to obtain the other 16 bits. the operation for an 8-bit port is similar, but requires four read cycles. the addressed device uses the dsack0 and dsack1 signals to indicate the port width. for instance, a 16-bit device always returns dsack0 = 1 and dsack1 = 0 for a 16-bit port, regardless of whether the bus cycle is a byte or word operation. dynamic bus sizing requires that the portion of the data bus used for a transfer to or from a particular port size be fixed. a 16-bit port must reside on data bus bits [15:0] and an 8-bit port must reside on data bus bits [15:8]. this minimizes the number of bus cycles needed to transfer data and ensures that the mcu transfers valid data. the mcu always attempts to transfer the maximum amount of data on all bus cycles. for a word oper- ation, it is assumed that the port is 16 bits wide when the bus cycle begins. operand bytes are desig- nated as shown in the following figure. op0 is the most significant byte of a long-word operand, and op3 is the least significant byte. the two bytes of a word-length operand are op0 (most significant) and op1. the single byte of a byte-length operand is op0. figure 8 operand byte order 3.4.10 operand alignment the data multiplexer establishes the necessary connections for different combinations of address and data sizes. the multiplexer takes the two bytes of the 16-bit bus and routes them to their required po- sitions. positioning of bytes is determined by the size and address outputs. siz1 and siz0 indicate the remaining number of bytes to be transferred during the current bus cycle. the number of bytes trans- ferred is equal to or less than the size indicated by siz1 and siz0, depending on port width. table 10 effect of dsack signals dsack1 dsack0 result 1 1 insert wait states in current bus cycle 1 0 complete cycle ?data bus port size is 8 bits 0 1 complete cycle ?data bus port size is 16 bits 0 0 reserved operand byte order 31 24 23 16 15 8 7 0 long word op0 op1 op2 op3 three byte op0 op1 op2 word op0 op1 byte op0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68332 motorola mc68332ts/d 29 addr0 also affects the operation of the data multiplexer. during an operand transfer, addr[23:1] in- dicate the word base address of the portion of the operand to be accessed, and addr0 indicates the byte offset from the base. 3.4.11 misaligned operands cpu32 processor architecture uses a basic operand size of 16 bits. an operand is misaligned when it overlaps a word boundary. this is determined by the value of addr0. when addr0 = 0 (an even ad- dress), the address is on a word and byte boundary. when addr0 = 1 (an odd address), the address is on a byte boundary only. a byte operand is aligned at any address; a word or long-word operand is misaligned at an odd address. the cpu32 does not support misaligned operand transfers. the largest amount of data that can be transferred by a single bus cycle is an aligned word. if the mcu transfers a long-word operand via a 16-bit port, the most significant operand word is transferred on the first bus cycle and the least significant operand word on a following bus cycle. 3.4.12 operand transfer cases the following table summarizes how operands are aligned for various types of transfers. opn entries are portions of a requested operand that are read or written during a bus cycle and are defined by siz1, siz0, and addr0 for that bus cycle. notes: 1. operands in parentheses are ignored by the cpu32 during read cycles. 2. three-byte transfer cases occur only as a result of a long word to byte transfer. 3. the cpu32 does not support misaligned word or long-word transfers. 3.5 chip selects typical microcontrollers require additional hardware to provide external chip-select signals. twelve in- dependently programmable chip selects provide fast two-cycle access to external memory or peripher- als. address block sizes of 2 kbytes to 1 mbyte can be selected. table 11 operand alignment transfer case siz1 siz0 addr0 dsack1 dsack0 data [15:8] data [7:0] byte to 8-bit port (even/odd) 0 1 x 1 0 op0 (op0) byte to 16-bit port (even) 0 1 0 0 x op0 (op0) byte to 16-bit port (odd) 0 1 1 0 x (op0) op0 word to 8-bit port (aligned) 1 0 0 1 0 op0 (op1) word to 8-bit port (misaligned) 3 1 0 1 1 0 op0 (op0) word to 16-bit port (aligned) 1 0 0 0 x op0 op1 word to 16-bit port (misaligned) 3 1 0 1 0 x (op0) op0 3 byte to 8-bit port (aligned) 2 1 1 0 1 0 op0 (op1) 3 byte to 8-bit port (misaligned) 2, 3 1 1 1 1 0 op0 (op0) 3 byte to 16-bit port (aligned) 2 1 1 0 0 x op0 op1 3 byte to 16-bit port (misaligned) 2, 3 1 1 1 0 x (op0) op0 long word to 8-bit port (aligned) 0 0 0 1 0 op0 (op1) long word to 8-bit port (misaligned) 3 1 0 1 1 0 op0 (op0) long word to 16-bit port (aligned) 0 0 0 0 x op0 op1 long word to 16-bit port (misaligned) 3 1 0 1 0 x (op0) op0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68332 30 mc68332ts/d chip-select assertion can be synchronized with bus control signals to provide output enable, read/write strobes, or interrupt acknowledge signals. logic can also generate dsack signals internally. a single dsack generator is shared by all circuits. multiple chip selects assigned to the same address and con- trol must have the same number of wait states. chip selects can also be synchronized with the eclk signal available on addr23. when a memory access occurs, chip-select logic compares address space type, address, type of ac- cess, transfer size, and interrupt priority (in the case of interrupt acknowledge) to parameters stored in chip-select registers. if all parameters match, the appropriate chip-select signal is asserted. select sig- nals are active low. refer to the following block diagram of a single chip-select circuit. figure 9 chip-select circuit block diagram the following table lists allocation of chip-selects and discrete outputs on the pins of the mcu. pin chip select discrete outputs csboot csboot ? br cs0 ? bg cs1 ? bgack cs2 ? fc0 cs3 pc0 fc1 cs4 pc1 fc2 cs5 pc2 addr19 cs6 pc3 addr20 cs7 pc4 addr21 cs8 pc5 addr22 cs9 pc6 addr23 cs10 eclk chip sel block avec generator dsack generator pin assignment register pin data register base address register timing and control address comparator option compare option register avec dsack pin bus control internal signals address f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68332 motorola mc68332ts/d 31 3.5.1 chip-select registers pin assignment registers cspar0 and cspar1 determine functions of chip-select pins. these regis- ters also determine port size (8- or 16-bit) for dynamic bus allocation. a pin data register (portc) latches discrete output data. blocks of addresses are assigned to each chip-select function. block sizes of 2 kbytes to 1 mbyte can be selected by writing values to the appropriate base address register (csbar). address blocks for separate chip-select functions can overlap. chip-select option registers (csorbt and csor[10:0]) determine timing of and conditions for asser- tion of chip-select signals. eight parameters, including operating mode, access size, synchronization, and wait state insertion can be specified. initialization code often resides in a peripheral memory device controlled by the chip-select circuits. a set of special chip-select functions and registers (csorbt, csbarbt) is provided to support bootstrap operation. 3.5.2 pin assignment registers the pin assignment registers (cspar0 and cspar1) contain pairs of bits that determine the function of chip-select pins. the pin assignment encodings used in these registers are shown below. cspar0 contains seven 2-bit fields that determine the functions of corresponding chip-select pins. cspar0[15:14] are not used. these bits always read zero; writes have no effect. cspar0 bit 1 always reads one; writes to cspar0 bit 1 have no effect. table 12 pin assignment encodings bit field description 00 discrete output 01 alternate function 10 chip select (8-bit port) 11 chip select (16-bit port) cspar0 ?chip select pin assignment register 0 $yffa44 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 0 cspa0[6] cspa0[5] cspa0[4] cspa0[3] cspa0[2] cspa0[1] csboot reset: 0 0 data2 1 data2 1 data2 1 data1 1 data1 1 data1 1 1 data0 table 13 cspar0 pin assignments cspar0 field chip select signal alternate signal discrete output cspa0[6] cs5 fc2 pc2 cspa0[5] cs4 fc1 pc1 cspa0[4] cs3 fc0 pc0 cspa0[3] cs2 bgack cspa0[2] cs1 bg cspa0[1] cs0 br csboot csboot f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68332 32 mc68332ts/d cspar1 contains five 2-bit fields that determine the functions of corresponding chip-select pins. cspar1[15:10] are not used. these bits always read zero; writes have no effect. at reset, either the alternate function (01) or chip-select function (11) can be encoded. data pins are driven to logic level one by a weak interval pull-up during reset. encoding is for chip-select function un- less a data line is held low during reset. note that bus loading can overcome the weak pull-up and hold pins low during reset. the following table shows the hierarchical selection method that determines the reset functions of pins controlled by cspar1. a pin programmed as a discrete output drives an external signal to the value specified in the port c pin data register (portc), with the following exceptions: 1. no discrete output function is available on pins br , bg , or bgack . 2. addr23 provides e-clock output rather than a discrete output signal. when a pin is programmed for discrete output or alternate function, internal chip-select logic still func- tions and can be used to generate dsack or avec internally on an address match. port size is determined when a pin is assigned as a chip select. when a pin is assigned to an 8-bit port, the chip select is asserted at all addresses within the block range. if a pin is assigned to a 16-bit port, the upper/lower byte field of the option register selects the byte with which the chip select is associated. cspar1 ?chip select pin assignment register 1 $yffa46 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 0 0 0 0 0 cspa1[4] cspa1[3] cspa1[2] cspa1[1] cspa1[0] reset: 0 0 0 0 0 0 data7 1 data [7:6] 1 data [7:5] 1 data [7:4] 1 data [7:3] 1 table 14 cspar1 pin assignments cspar0 field chip select signal alternate signal discrete output cspa1[4] cs10 addr23 eclk cspa1[3] cs9 addr22 pc6 cspa1[2] cs8 addr21 pc5 cspa1[1] cs7 addr20 pc4 cspa1[0] cs6 addr19 pc3 table 15 reset pin function of cs[10:6] data bus pins at reset chip-select/address bus pin function data7 data6 data5 data4 data3 cs10 / addr23 cs9 / addr22 cs8 / addr21 cs7 / addr20 cs6 / addr19 11111 cs10 cs9 cs8 cs7 cs6 1111 0 cs10 cs9 cs8 cs7 addr19 111 0 x cs10 cs9 cs8 addr20 addr19 11 0 x x cs10 cs9 addr21 addr20 addr19 1 0 x x x cs10 addr22 addr21 addr20 addr19 0xxxx addr23 addr22 addr21 addr20 addr19 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68332 motorola mc68332ts/d 33 3.5.3 base address registers a base address is the starting address for the block enabled by a given chip select. block size deter- mines the extent of the block above the base address. each chip select has an associated base register so that an efficient address map can be constructed for each application. if a chip-select base address register is programmed with the same address as a microcontroller module or memory array, an access to that address goes to the module or array and the chip-select signal is not asserted. addr[23:11] ? base address field this field sets the starting address of a particular address space. the address compare logic uses only the most significant bits to match an address within a block. the value of the base address must be a multiple of block size. base address register diagrams show how base register bits correspond to ad- dress lines. blksz ? block size field this field determines the size of the block that must be enabled by the chip select. the following table shows bit encoding for the base address registers block size field. 3.5.4 option registers the option registers contain eight fields that determine timing of and conditions for assertion of chip- select signals. for a chip-select signal to be asserted, all bits in the base address register must match the corresponding internal upper address lines, and all conditions specified in the option register must be satisfied. these conditions also apply to providing dsack or autovector support. csbarbt ? chip-select base address register boot rom $yffa48 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0 addr 23 addr 22 addr 21 addr 20 addr 19 addr 18 addr 17 addr 16 addr 15 addr 14 addr 13 addr 12 addr 11 blksz reset: 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 csbar[10:0] ?hip-select base address registers $yffa4c?yffa74 15 14 13 12 11 10 9 8 7 6 5 4 3 2 0 addr 23 addr 22 addr 21 addr 20 addr 19 addr 18 addr 17 addr 16 addr 15 addr 14 addr 13 addr 12 addr 11 blksz reset: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 block size field block size address lines compared 000 2 k addr[23:11] 001 8 k addr[23:13] 010 16 k addr[23:14] 011 64 k addr[23:16] 100 128 k addr[23:17] 101 256 k addr[23:18] 110 512 k addr[23:19] 111 1 m addr[23:20] f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68332 34 mc68332ts/d csorbt, the option register for csboot , contains special reset values that support bootstrap opera- tions from peripheral memory devices. the following bit descriptions apply to both csorbt and csor[10:0] option registers. mode ? asynchronous/synchronous mode 0 = asynchronous mode selected (chip-select assertion determined by internal or external bus con- trol signals) 1 = synchronous mode selected (chip-select assertion synchronized with eclk signal) in asynchronous mode, the chip select is asserted synchronized with as or ds . the dsack field is not used in synchronous mode because a bus cycle is only performed as a syn- chronous operation. when a match condition occurs on a chip select programmed for synchronous op- eration, the chip select signals the ebi that an eclk cycle is pending. byte ? upper/lower byte option this field is used only when the chip-select 16-bit port option is selected in the pin assignment register. the following table lists upper/lower byte options. r/w ? read/write this field causes a chip select to be asserted only for a read, only for a write, or for both read and write. refer to the following table for options available. strb ? address strobe/data strobe 0 = address strobe 1 = data strobe this bit controls the timing for assertion of a chip select in asynchronous mode. selecting address strobe causes chip select to be asserted synchronized with address strobe. selecting data strobe caus- es chip select to be asserted synchronized with data strobe. csorbt ?chip-select option register boot rom $yffa4a 15 14 13 12 11 10 9 6 5 4 3 1 0 mode byte r/w strb dsack space ipl avec reset: 0 1 1 1 1 0 1 1 0 1 1 1 0 0 0 0 csor[10:0] ?hip-select option registers $yffa4e?yffa76 15 14 13 12 11 10 9 6 5 4 3 1 0 mode byte r/w strb dsack space ipl avec reset: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 byte description 00 disable 01 lower byte 10 upper byte 11 both bytes r/w description 00 reserved 01 read only 10 write only 11 read/write f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68332 motorola mc68332ts/d 35 dsack ? data and size acknowledge this field specifies the source of dsack in asynchronous mode. it also allows the user to adjust bus timing with internal dsack generation by controlling the number of wait states that are inserted to op- timize bus speed in a particular application. the following table shows the dsack field encoding. the fast termination encoding (1110) is used for two-cycle access to external memory. space ? address space use this option field to select an address space for the chip-select logic. the cpu32 normally operates in supervisor or user space, but interrupt acknowledge cycles must take place in cpu space. ipl ? interrupt priority level if the space field is set for cpu space (00), chip-select logic can be used for interrupt acknowledge. during an interrupt acknowledge cycle, the priority level on address lines addr[3:1] is compared to the value in the ipl field. if the values are the same, a chip select is asserted, provided that other option register conditions are met. the following table shows ipl field encoding. this field only affects the response of chip selects and does not affect interrupt recognition by the cpu. any level means that chip select is asserted regardless of the level of the interrupt acknowledge cycle. dsack description 0000 no wait states 0001 1 wait state 0010 2 wait states 0011 3 wait states 0100 4 wait states 0101 5 wait states 0110 6 wait states 0111 7 wait states 1000 8 wait states 1001 9 wait states 1010 10 wait states 1011 11 wait states 1100 12 wait states 1101 13 wait states 1110 fast termination 1111 external dsack space field address space 00 cpu space 01 user space 10 supervisor space 11 supervisor/user space ipl description 000 any level 001 ipl1 010 ipl2 011 ipl3 100 ipl4 101 ipl5 110 ipl6 111 ipl7 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68332 36 mc68332ts/d avec ? autovector enable 0 = external interrupt vector enabled 1 = autovector enabled this field selects one of two methods of acquiring the interrupt vector during the interrupt acknowledge cycle. it is not usually used in conjunction with a chip-select pin. if the chip select is configured to trigger on an interrupt acknowledge cycle (space = 00) and the avec field is set to one, the chip select automatically generates an avec in response to the interrupt cycle. otherwise, the vector must be supplied by the requesting device. the avec bit must not be used in synchronous mode, as autovector response timing can vary because of eclk synchronization. 3.5.5 port c data register bit values in port c determine the state of chip-select pins used for discrete output. when a pin is as- signed as a discrete output, the value in this register appears at the output. this is a read/write register. bit 7 is not used. writing to this bit has no effect, and it always returns zero when read. 3.6 general-purpose input/output sim pins can be configured as two general-purpose i/o ports, e and f. the following paragraphs de- scribe registers that control the ports. a write to the port e data register is stored in the internal data latch and, if any port e pin is configured as an output, the value stored for that bit is driven on the pin. a read of the port e data register returns the value at the pin only if the pin is configured as a discrete input. otherwise, the value read is the value stored in the register. the port e data register is a single register that can be accessed in two locations. when accessed at $yffa11, the register is referred to as porte0; when accessed at $yffa13, the register is referred to as porte1. the register can be read or written at any time. it is unaffected by reset. the bits in this register control the direction of the pin drivers when the pins are configured as i/o. any bit in this register set to one configures the corresponding pin as an output. any bit in this register cleared to zero configures the corresponding pin as an input. this register can be read or written at any time. portc ? port c data register $yffa41 15 8 7 6 5 4 3 2 1 0 not used 0 pc6 pc5 pc4 pc3 pc2 pc1 pc0 reset: 0 1 1 1 1 1 1 1 porte0, porte1 ?ort e data register $yffa11, $yffa13 15 8 7 6 5 4 3 2 1 0 not used pe7 pe6 pe5 pe4 pe3 pe2 pe1 pe0 reset: u u u u u u u u ddre ?port e data direction register $yffa15 15 8 7 6 5 4 3 2 1 0 not used dde7 dde6 dde5 dde4 dde3 dde2 dde1 dde0 reset: 0 0 0 0 0 0 0 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68332 motorola mc68332ts/d 37 the bits in this register control the function of each port e pin. any bit set to one configures the corre- sponding pin as a bus control signal, with the function shown in the following table. any bit cleared to zero defines the corresponding pin to be an i/o pin, controlled by porte and ddre. data bus bit 8 controls the state of this register following reset. if data8 is set to one during reset, the register is set to $ff, which defines all port e pins as bus control signals. if data8 is cleared to zero during reset, this register is set to $00, configuring all port e pins as i/o pins. any bit cleared to zero defines the corresponding pin to be an i/o pin. any bit set to one defines the corresponding pin to be a bus control signal. the write to the port f data register is stored in the internal data latch, and if any port f pin is configured as an output, the value stored for that bit is driven onto the pin. a read of the port f data register returns the value at the pin only if the pin is configured as a discrete input. otherwise, the value read is the value stored in the register. the port f data register is a single register that can be accessed in two locations. when accessed at $yffa19, the register is referred to as portf0; when accessed at $yffa1b, the register is referred to as portf1. the register can be read or written at any time. it is unaffected by reset. the bits in this register control the direction of the pin drivers when the pins are configured for i/o. any bit in this register set to one configures the corresponding pin as an output. any bit in this register cleared to zero configures the corresponding pin as an input. pepar ? port e pin assignment register $yffa17 15 8 7 6 5 4 3 2 1 0 not used pepa7 pepa6 pepa5 pepa4 pepa3 pepa2 pepa1 pepa0 reset: data8 data8 data8 data8 data8 data8 data8 data8 table 16 port e pin assignments pepar bit port e signal bus control signal pepa7 pe7 siz1 pepa6 pe6 siz0 pepa5 pe5 as pepa4 pe4 ds pepa3 pe3 rmc pepa2 pe2 avec pepa1 pe1 dsack1 pepa0 pe0 dsack0 portf0, portf1 ?port f data register $yffa19, $yffa1b 15 8 7 6 5 4 3 2 1 0 not used pf7 pf6 pf5 pf4 pf3 pf2 pf1 pf0 reset: u u u u u u u u ddrf ?port f data direction register $yffa1d 15 8 7 6 5 4 3 2 1 0 not used ddf7 ddf6 ddf5 ddf4 ddf3 ddf2 ddf1 ddf0 reset: 0 0 0 0 0 0 0 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68332 38 mc68332ts/d the bits in this register control the function of each port f pin. any bit cleared to zero defines the corre- sponding pin to be an i/o pin. any bit set to one defines the corresponding pin to be an interrupt request signal or modclk. the modclk signal has no function after reset. data bus pin 9 controls the state of this register following reset. if data9 is set to one during reset, the register is set to $ff, which defines all port f pins as interrupt request inputs. if data9 is cleared to zero during reset, this register is set to $00, defining all port f pins as i/o pins. 3.7 resets reset procedures handle system initialization and recovery from catastrophic failure. the mcu per- forms resets with a combination of hardware and software. the system integration module determines whether a reset is valid, asserts control signals, performs basic system configuration based on hard- ware mode-select inputs, then passes control to the cpu. reset occurs when an active low logic level on the reset pin is clocked into the sim. resets are gated by the clkout signal. asynchronous resets are assumed to be catastrophic. an asynchronous reset can occur on any clock edge. synchronous resets are timed to occur at the end of bus cycles. if there is no clock when reset is asserted, reset does not occur until the clock starts. resets are clocked in order to allow completion of write cycles in progress at the time reset is asserted. reset is the highest-priority cpu32 exception. any processing in progress is aborted by the reset ex- ception, and cannot be restarted. only essential tasks are performed during reset exception processing. other initialization tasks must be accomplished by the exception handler routine. 3.7.1 sim reset mode selection the logic states of certain data bus pins during reset determine sim operating configuration. in addition, the state of the modclk pin determines system clock source and the state of the bkpt pin determines what happens during subsequent breakpoint assertions. the following table is a summary of reset mode selection options. pfpar ? port f pin assignment register $yffa1f 15 8 7 6 5 4 3 2 1 0 not used pfpa7 pfpa6 pfpa5 pfpa4 pfpa3 pfpa2 pfpa1 pfpa0 reset: data9 data9 data9 data9 data9 data9 data9 data9 table 17 port f pin assignments pfpar field port f signal alternate signal pfpa7 pf7 irq7 pfpa6 pf6 irq6 pfpa5 pf5 irq5 pfpa4 pf4 irq4 pfpa3 pf3 irq3 pfpa2 pf2 irq2 pfpa1 pf1 irq1 pfpa0 pf0 modclk table 18 reset mode selection mode select pin default function (pin left high) alternate function (pin pulled low) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68332 motorola mc68332ts/d 39 3.7.2 functions of pins for other modules during reset generally, pins associated with modules other than the sim default to port functions, and input/output ports are set to input state. this is accomplished by disabling pin functions in the appropriate control registers, and by clearing the appropriate port data direction registers. refer to individual module sec- tions in this manual for more information. the following table is a summary of module pin function out of reset. data0 csboot 16-bit csboot 8-bit data1 cs0 cs1 cs2 br bg bgack data2 cs3 cs4 cs5 fc0 fc1 fc2 data3 data4 data5 data6 data7 cs6 cs[7:6] cs[8:6] cs[9:6] cs[10:6] addr19 addr[20:19] addr[21:19] addr[22:19] addr[23:19] data8 dsack0 , dsack1 , avec , ds , as , siz[1:0] porte data9 irq[7:1] modclk portf data11 test mode disabled test mode enabled modclk vco = system clock extal = system clock bkpt background mode disabled background mode enabled table 19 module pin functions module pin mnemonic function cpu32 dsi/ifetch dsi/ifetch dso/ipipe dso/ipipe bkpt /dsclk bkpt /dsclk gpt pgp7/ic4/oc5 discrete input pgp[6:3]/oc[4:1] discrete input pgp[2:0]/ic[3:1] discrete input pai discrete input pclk discrete input pwma, pwmb discrete output qsm pqs7/txd discrete input pqs[6:4]/pcs[3:1] discrete input pqs3/pcs0/ss discrete input pqs2/sck discrete input pqs1/mosi discrete input pqs0/miso discrete input rxd rxd table 18 reset mode selection f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68332 40 mc68332ts/d 3.7.3 reset timing the reset input must be asserted for a specified minimum period in order for reset to occur. external reset assertion can be delayed internally for a period equal to the longest bus cycle time (or the bus monitor time-out period) in order to protect write cycles from being aborted by reset. while reset is asserted, sim pins are either in a disabled high-impedance state or are driven to their inactive states. when an external device asserts reset for the proper period, reset control logic clocks the signal into an internal latch. the control logic drives the reset pin low for an additional 512 clkout cycles after it detects that the reset signal is no longer being externally driven, to guarantee this length of reset to the entire system. if an internal source asserts a reset signal, the reset control logic asserts reset for a minimum of 512 cycles. if the reset signal is still asserted at the end of 512 cycles, the control logic continues to assert reset until the internal reset signal is negated. after 512 cycles have elapsed, the reset input pin goes to an inactive, high-impedance state for ten cy- cles. at the end of this 10-cycle period, the reset input is tested. when the input is at logic level one, reset exception processing begins. if, however, the reset input is at logic level zero, the reset control logic drives the pin low for another 512 cycles. at the end of this period, the pin again goes to high- impedance state for ten cycles, then it is tested again. the process repeats until reset is released. 3.7.4 power-on reset when the sim clock synthesizer is used to generate the system clock, power-on reset involves special circumstances related to application of system and clock synthesizer power. regardless of clock source, voltage must be applied to clock synthesizer power input pin v ddsyn in order for the mcu to operate. the following discussion assumes that v ddsyn is applied before and during reset. this mini- mizes crystal start-up time. when v ddsyn is applied at power-on, start-up time is affected by specific crystal parameters and by oscillator circuit design. v dd ramp-up time also affects pin state during reset. during power-on reset, an internal circuit in the sim drives the internal (imb) and external reset lines. the circuit releases the internal reset line as v dd ramps up to the minimum specified value, and sim pins are initialized. when v dd reaches the specified minimum value, the clock synthesizer vco begins operation. clock frequency ramps up to the specified limp mode frequency. the external reset line remains asserted until the clock synthesizer pll locks and 512 clkout cycles elapse. the sim clock synthesizer provides clock signals to the other mcu modules. after the clock is running and the internal reset signal is asserted for four clock cycles, these modules reset. v dd ramp time and vco frequency ramp time determine how long these four cycles take. worst case is approximately 15 milliseconds. during this period, module port pins may be in an indeterminate state. while input-only pins can be put in a known state by means of external pull-up resistors, external logic on input/output or output-only pins must condition the lines during this time. active drivers require high-impedance buff- ers or isolation resistors to prevent conflict. 3.7.5 use of three state control pin asserting the three-state control (tsc) input causes the mcu to put all output drivers in an inactive, high-impedance state. the signal must remain asserted for ten clock cycles in order for drivers to change state. there are certain constraints on use of tsc during power-on reset: when the internal clock synthesizer is used (modclk held high during reset), synthesizer ramp- up time affects how long the ten cycles take. worst case is approximately 20 milliseconds from tsc assertion. when an external clock signal is applied (modclk held low during reset), pins go to high-imped- ance state as soon after tsc assertion as ten clock pulses have been applied to the extal pin. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68332 motorola mc68332ts/d 41 when tsc assertion takes effect, internal signals are forced to values that can cause inadvertent mode selection. once the output drivers change state, the mcu must be powered down and re- started before normal operation can resume. 3.8 interrupts interrupt recognition and servicing involve complex interaction between the central processing unit, the system integration module, and a device or module requesting interrupt service. the cpu32 provides for eight levels of interrupt priority (0e7), seven automatic interrupt vectors, and 200 assignable interrupt vectors. all interrupts with priorities less than seven can be masked by the in- terrupt priority (ip) field in the status register. the cpu32 handles interrupts as a type of asynchronous exception. interrupt recognition is based on the states of interrupt request signals iirq[7:1] and the ip mask value. each of the signals corresponds to an interrupt priority. irq1 has the lowest priority, and irq7 has the highest priority. the ip field consists of three bits. binary values %000 to %111 provide eight priority masks. masks pre- vent an interrupt request of a priority less than or equal to the mask value (except for irq7 ) from being recognized and processed. when ip contains %000, no interrupt is masked. during exception process- ing, the ip field is set to the priority of the interrupt being serviced. interrupt request signals can be asserted by external devices or by microcontroller modules. request lines are connected internally by means of a wired nor ? simultaneous requests of differing priority can be made. internal assertion of an interrupt request signal does not affect the logic state of the cor- responding mcu pin. external interrupt requests are routed to the cpu via the external bus interface and sim interrupt control logic. the cpu treats external interrupt requests as though they come from the sim. external irq[6:1] are active-low level-sensitive inputs. external irq7 is an active-low transition-sensi- tive input. irq7 requires both an edge and a voltage level for validity. irq[6:1] are maskable. irq7 is nonmaskable. the irq7 input is transition-sensitive in order to prevent redundant servicing and stack overflow. a nonmaskable interrupt is generated each time irq7 is as- serted, and each time the priority mask changes from %111 to a lower number whileirq7 is asserted. interrupt requests are sampled on consecutive falling edges of the system clock. interrupt request input circuitry has hysteresis. to be valid, a request signal must be asserted for at least two consecutive clock periods. valid requests do not cause immediate exception processing, but are left pending. pending re- quests are processed at instruction boundaries or when exception processing of higher-priority excep- tions is complete. the cpu32 does not latch the priority of a pending interrupt request. if an interrupt source of higher priority makes a service request while a lower priority request is pending, the higher priority request is serviced. if an interrupt request of equal or lower priority than the current ip mask value is made, the cpu does not recognize the occurrence of the request in any way. 3.8.1 interrupt acknowledge and arbitration interrupt acknowledge bus cycles are generated during exception processing. when the cpu detects one or more interrupt requests of a priority higher than the interrupt priority mask value, it performs a cpu space read from address $fffff : [ip] : 1. the cpu space read cycle performs two functions: it places a mask value corresponding to the highest priority interrupt request on the address bus, and it acquires an exception vector number from the inter- rupt source. the mask value also serves two purposes: it is latched into the ccr ip field in order to f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68332 42 mc68332ts/d mask lower-priority interrupts during exception processing, and it is decoded by modules that have re- quested interrupt service to determine whether the current interrupt acknowledge cycle pertains to them. modules that have requested interrupt service decode the ip value placed on the address bus at the beginning of the interrupt acknowledge cycle, and if their requests are at the specified ip level, respond to the cycle. arbitration between simultaneous requests of the same priority is performed by means of serial contention between module interrupt arbitration (iarb) field bit values. each module that can make an interrupt service request, including the sim, has an iarb field in its con- figuration register. an iarb field can be assigned a value from %0001 (lowest priority) to %1111 (high- est priority). a value of %0000 in an iarb field causes the cpu to process a spurious interrupt exception when an interrupt from that module is recognized. because the ebi manages external interrupt requests, the sim iarb value is used for arbitration be- tween internal and external interrupt requests. the reset value of iarb for the sim is %1111, and the reset iarb value for all other modules is %0000. initialization software must assign different iarb val- ues in order to implement an arbitration scheme. each module must have a unique iarb value. when two or more iarb fields have the same nonzero value, the cpu interprets multiple vector numbers simultaneously, with unpredictable consequences. arbitration must always take place, even when a single source requests service. this point is important for two reasons: the cpu interrupt acknowledge cycle is not driven on the external bus unless the sim wins contention, and failure to contend causes an interrupt acknowledge bus cycle to be terminated by a bus error, which causes a spurious interrupt exception to be taken. when arbitration is complete, the dominant module must place an interrupt vector number on the data bus and terminate the bus cycle. in the case of an external interrupt request, because the interrupt ac- knowledge cycle is transferred to the external bus, an external device must decode the mask value and respond with a vector number, then generate bus cycle termination signals. if the device does not re- spond in time, a spurious interrupt exception is taken. the periodic interrupt timer (pit) in the sim can generate internal interrupt requests of specific priority at predetermined intervals. by hardware convention, pit interrupts are serviced before external inter- rupt service requests of the same priority. refer to 3.2.7 periodic interrupt timer for more information. 3.8.2 interrupt processing summary a summary of the interrupt processing sequence follows. when the sequence begins, a valid interrupt service request has been detected and is pending. a. the cpu finishes higher priority exception processing or reaches an instruction boundary. b. processor state is stacked. the contents of the status register and program counter are saved. c. the interrupt acknowledge cycle begins: 1. fc[2:0] are driven to %111 (cpu space) encoding. 2. the address bus is driven as follows. addr[23:20] = %1111; addr[19:16] = %1111, which indicates that the cycle is an interrupt acknowledge cpu space cycle; addr[15:4] = %111111111111; addr[3:1] = the level of the interrupt request being acknowledged; and addr0 = %1. 3. request priority level is latched into the ip field in the status register from the address bus. d. modules or external peripherals that have requested interrupt service decode the request level in addr[3:1]. if the request level of at least one interrupting module or device is the same as the value in addr[3:1], interrupt arbitration contention takes place. when there is no conten- tion, the spurious interrupt monitor asserts berr , and a spurious interrupt exception is pro- cessed. e. after arbitration, the interrupt acknowledge cycle can be completed in one of three ways: f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68332 motorola mc68332ts/d 43 1. the dominant interrupt source supplies a vector number and dsack signals appropriate to the access. the cpu32 acquires the vector number. 2. the avec signal is asserted (the signal can be asserted by the dominant interrupt source or the pin can be tied low), and the cpu32 generates an autovector number corresponding to interrupt priority. 3. the bus monitor asserts berr and the cpu32 generates the spurious interrupt vector number. f. the vector number is converted to a vector address. g. the content of the vector address is loaded into the pc, and the processor transfers control to the exception handler routine. 3.9 factory test block the test submodule supports scan-based testing of the various mcu modules. it is integrated into the sim to support production testing. test submodule registers are intended for motorola use. register names and addresses are provided to indicate that these addresses are occupied. simtr ?system integration test register $yffa02 simtre ?system integration test register (e clock) $yffa08 tstmsra ?master shift register a $yffa30 tstmsrb ?master shift register b $yffa32 tstsc ?test module shift count $yffa34 tstrc ?test module repetition count $yffa36 creg ?test module control register $yffa38 dreg ?test module distributed register $yffa3a f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68332 44 mc68332ts/d 4 central processor unit based on the powerful mc68020, the cpu32 processing module provides enhanced system perfor- mance and also uses the extensive software base for the motorola m68000 family. 4.1 overview the cpu32 is fully object code compatible with the m68000 family, which excels at processing calcu- lation-intensive algorithms and supporting high-level languages. the cpu32 supports all of the mc68010 and most of the mc68020 enhancements, such as virtual memory support, loop mode oper- ation, instruction pipeline, and 32-bit mathematical operations. powerful addressing modes provide compatibility with existing software programs and increase the efficiency of high-level language compil- ers. special instructions, such as table lookup and interpolate and low-power stop, support the specific requirements of controller applications. also included is the background debugging mode, an alternate operating mode that suspends normal operation and allows the cpu to accept debugging commands from the development system. ease of programming is an important consideration in using a microcontroller. the cpu32 instruction set is optimized for high performance. the eight 32-bit general-purpose data registers readily support 8-bit (byte), 16-bit (word), and 32-bit (long word) operations. ease of program checking and diagnosis is further enhanced by trace and trap capabilities at the instruction level. use of high-level languages is increasing as controller applications become more complex and control programs become larger. high-level languages aid rapid development of software, with less error, and are readily portable. the cpu32 instruction set supports high-level languages. 4.2 programming model the cpu32 has sixteen 32-bit general registers, a 32-bit program counter, one 32-bit supervisor stack pointer, a 16-bit status register, two alternate function code registers, and a 32-bit vector base register. the programming model of the cpu32 consists of a user model and supervisor model, corresponding to the user and supervisor privilege levels. some instructions available at the supervisor level are not available at the user level, allowing the supervisor to protect system resources from uncontrolled ac- cess. bit s in the status register determines the privilege level. the user programming model remains unchanged from previous m68000 family microprocessors. ap- plication software written to run at the non-privileged user level migrates without modification to the cpu32 from any m68000 platform. the move from sr instruction, however, is privileged in the cpu32. it is not privileged in the m68000. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68332 motorola mc68332ts/d 45 31 16 15 8 7 0 d0 d1 d2 d3 data registers d4 d5 d6 d7 31 16 15 0 a0 a1 a2 a3 address registers a4 a5 a6 31 16 15 0 a7 (usp) user stack pointer 31 0 pc program counter 70 ccr condition code register figure 10 user programming model 31 16 15 0 a7' (ssp) supervisor stack pointer 15 8 7 0 (ccr) sr status register 31 0 vbr vector base register 20 sfc alternate function dfc code registers figure 11 supervisor programming model supplement f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68332 46 mc68332ts/d 4.3 status register the status register contains the condition codes that reflect the results of a previous operation and can be used for conditional instruction execution in a program. the lower byte containing the condition codes is the only portion of the register available at the user privilege level; it is referenced as the con- dition code register (ccr) in user programs. at the supervisor privilege level, software can access the full status register, including the interrupt priority mask and additional control bits. system byte t[1:0] ?trace enable s ?supervisor/user state bits [12:11] ?unimplemented ip[2:0] ?interrupt priority mask user byte (condition code register) bits [7:5] ? unimplemented x ? extend n ? negative z ? zero v ? overflow c ? carry 4.4 data types six basic data types are supported: bits packed binary coded decimal digits byte integers (8 bits) word integers (16 bits) long-word integers (32 bits) quad-word integers (64 bits) 4.5 addressing modes addressing in the cpu32 is register-oriented. most instructions allow the results of the specified oper- ation to be placed either in a register or directly in memory. this flexibility eliminates the need for extra instructions to store register contents in memory. the cpu32 supports seven basic addressing modes: register direct register indirect register indirect with index program counter indirect with displacement program counter indirect with index absolute immediate included in the register indirect addressing modes are the capabilities to post-increment, predecrement, and offset. the program counter relative mode also has index and offset capabilities. in addition to these addressing modes, many instructions implicitly specify the use of the status register, stack point- er, or program counter. sr ?status register 15 14 13 12 11 10 8 7 6 5 4 3 2 1 0 t1 t0 s 0 0 ip 0 0 0 x n z v c reset: 0 0 1 0 0 1 1 1 0 0 0 u u u u u f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68332 motorola mc68332ts/d 47 4.6 instruction set summary table 20 instruction set summary instruction syntax operand size operation abcd dn, dn - (an), - (an) 8 8 source 10 + destination 10 + x t destination add dn, , dn 8, 16, 32 8, 16, 32 source + destination t destination adda , an 16, 32 source + destination t destination addi #, 8, 16, 32 immediate data + destination t destination addq # , 8, 16, 32 immediate data + destination t destination addx dn, dn - (an), - (an) 8, 16, 32 8, 16, 32 source + destination + x t destination and , dn dn, 8, 16, 32 8, 16, 32 source destination t destination andi # , 8, 16, 32 data destination t destination andi to ccr # , ccr 8 source ccr t ccr andi to sr1 1 # , sr 16 source sr t sr asl dn, dn # , dn 8, 16, 32 8, 16, 32 16 asr dn, dn # , dn 8, 16, 32 8, 16, 32 16 bcc label 8, 16, 32 if condition true, then pc + d t pc bchg dn, # , 8, 32 8, 32 bclr dn, # , 8, 32 8, 32 0 t bit of destination bgnd none none if background mode enabled, then enter background mode, else format/vector t - (ssp); pc t - (ssp); sr t - (ssp); (vector) t pc bkpt # none if breakpoint cycle acknowledged, then execute returned operation word, else trap as illegal instruction bra label 8, 16, 32 pc + d t pc bset dn, # , 8, 32 8, 32 1 t bit of destination bsr label 8, 16, 32 sp - 4 t sp; pc t (sp); pc + d t pc btst dn, # , 8, 32 8, 32 chk , dn 16, 32 if dn < 0 or dn > (ea), then chk exception chk2 , rn 8, 16, 32 if rn < lower bound or rn > upper bound, then chk exception clr 8, 16, 32 0 t destination cmp , dn 8, 16, 32 (destination - source), ccr shows results cmpa , an 16, 32 (destination - source), ccr shows results cmpi # , 8, 16, 32 (destination - data), ccr shows results cmpm (an) + , (an) + 8, 16, 32 (destination - source), ccr shows results cmp2 , rn 8, 16, 32 lower bound rn upper bound, ccr shows result x/c 0 x/c bit number ? of destination ) z bit of destinati o tt bit number ? of destination () z bit number ? of destination () z; t bit number ? of destination () z t f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68332 48 mc68332ts/d dbcc dn, label 16 if condition false, then dn - 1 t pc; if dn 1 ( - 1), then pc + d t pc divs/divu , dn 32/16 t 16 : 16 destination / source t destination (signed or unsigned) divsl/divul , dr : dq , dq , dr : dq 64/32 t 32 : 32 32/32 t 32 32/32 t 32 : 32 destination / source t destination (signed or unsigned) eor dn, 8, 16, 32 source ? destination t destination eori # , 8, 16, 32 data ? destination t destination eori to ccr # , ccr 8 source ? ccr t ccr eori to sr 1 # , sr 16 source ? sr t sr exg rn, rn 32 rn t rn ext dn dn 8 t 16 16 t 32 sign extended destination t destination extb dn 8 t 32 sign extended destination t destination illegal none none ssp - 2 t ssp; vector offset t (ssp); ssp - 4 t ssp; pc t (ssp); ssp - 2 t ssp; sr t (ssp); illegal instruction vector address t pc jmp none destination t pc jsr none sp - 4 t sp; pc t (sp); destination t pc lea , an 32 t an link an, # d 16, 32 sp - 4 t sp, an t (sp); sp t an, sp + d t sp lpstop 1 # 16 data t sr; interrupt mask t ebi; stop lsl dn, dn # , dn 8, 16, 32 8, 16, 32 16 lsr dn, dn #, dn 8, 16, 32 8, 16, 32 16 move , 8, 16, 32 source t destination movea , an 16, 32 t 32 source t destination movea 1 usp, an an, usp 32 32 usp t an an t usp move from ccr ccr, 16 ccr t destination move to ccr , ccr 16 source t ccr move from sr 1 sr, 16 sr t destination move to sr 1 , sr 16 source t sr move usp 1 usp, an an, usp 32 32 usp t an an t usp movec 1 rc, rn rn, rc 32 32 rc t rn rn t rc movem list, , list 16, 32 16, 32 t 32 listed registers t destination source t listed registers movep dn, (d16, an) (d16, an), dn 16, 32 dn [31 : 24] t (an + d); dn [23 : 16] t (an + d + 2); dn [15 : 8] t (an + d + 4); dn [7 : 0] t (an + d + 6) (an + d) t dn [31 : 24]; (an + d + 2) t dn [23 : 16]; (an + d + 4) t dn [15 : 8]; (an + d + 6) t dn [7 : 0] moveq #, dn 8 t 32 immediate data t destination table 20 instruction set summary(continued) instruction syntax operand size operation x/c 0 x/c 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68332 motorola mc68332ts/d 49 moves 1 rn, , rn 8, 16, 32 rn t destination using dfc source using sfc t rn muls/mulu , dn , dl , dh : dl 16 * 16 t 32 32 * 32 t 32 32 * 32 t 64 source * destination t destination (signed or unsigned) nbcd 8 8 0 - destination 10 - x t destination neg 8, 16, 32 0 - destination t destination negx 8, 16, 32 0 - destination - x t destination nop none none pc + 2 t pc not 8, 16, 32 destination t destination or , dn dn, 8, 16, 32 8, 16, 32 source + destination t destination ori #, 8, 16, 32 data + destination t destination ori to ccr #, ccr 16 source + ccr t sr ori to sr 1 #, sr 16 source ; sr t sr pea 32 sp - 4 t sp; t sp reset 1 none none assert reset line rol dn, dn #, dn 8, 16, 32 8, 16, 32 16 ror dn, dn #, dn 8, 16, 32 8, 16, 32 16 roxl dn, dn #, dn 8, 16, 32 8, 16, 32 16 roxr dn, dn #, dn 8, 16, 32 8, 16, 32 16 rtd #d 16 (sp) t pc; sp + 4 + d t sp rte 1 none none (sp) t sr; sp + 2 t sp; (sp) t pc; sp + 4 t sp; restore stack according to format rtr none none (sp) t ccr; sp + 2 t sp; (sp) t pc; sp + 4 t sp rts none none (sp) t pc; sp + 4 t sp sbcd dn, dn - (an), - (an) 8 8 destination10 - source10 - x t destination scc 8 if condition true, then destination bits are set to 1; else, destination bits are cleared to 0 stop 1 # 16 data t sr; stop sub , dn dn, 8, 16, 32 destination - source t destination suba , an 16, 32 destination - source t destination subi #, 8, 16, 32 destination - data t destination subq #, 8, 16, 32 destination - data t destination subx dn, dn - (an), - (an) 8, 16, 32 8, 16, 32 destination - source - x t destination table 20 instruction set summary(continued) instruction syntax operand size operation c c c x c x f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68332 50 mc68332ts/d 1. privileged instruction. swap dn 16 tas 8 destination tested condition codes bit 7 of destination tbls/tblu , dn dym : dyn, dn 8, 16, 32 dyn - dym t temp (temp * dn [7 : 0]) t temp (dym * 256) + temp t dn tblsn/tblun , dn dym : dyn, dn 8, 16, 32 dyn - dym t temp (temp * dn [7 : 0]) / 256 t temp dym + temp t dn trap # none ssp - 2 t ssp; format/vector offset t (ssp); ssp - 4 t ssp; pc t (ssp); sr t (ssp); vector address t pc trapcc none # none 16, 32 if cc true, then trap exception trapv none none if v set, then overflow trap exception tst 8, 16, 32 source - 0, to set condition codes unlk an 32 an t sp; (sp) t an, sp + 4 t sp table 20 instruction set summary(continued) instruction syntax operand size operation msw lsw f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68332 motorola mc68332ts/d 51 4.7 background debugging mode the background debugger on the cpu32 is implemented in cpu microcode. the background debug- ging commands are summarized below. table 21 background debuggung mode command mnemonic description read d/a register rdreg/rareg read the selected address or data register and return the results through the serial interface. write d/a register wdreg/wareg the data operand is written to the specified address or data register. read system register rsreg the specified system control register is read. all registers that can be read in supervisor mode can be read in background mode. write system register wsreg the operand data is written into the specified system control register. read memory location read read the sized data at the memory location specified by the long-word address. the source function code register (sfc) determines the address space accessed. write memory location write write the operand data to the memory location specified by the long-word address. the destination function code (dfc) register determines the address space accessed. dump memory block dump used in conjunction with the read command to dump large blocks of memory. an initial read is executed to set up the starting address of the block and retrieve the first result. subsequent operands are retrieved with the dump command. fill memory block fill used in conjunction with the write command to fill large blocks of memory. initially, a write is executed to set up the starting address of the block and supply the first operand. the fill command writes subsequent operands. resume execution go the pipe is flushed and refilled before resuming instruction execution at the current pc. patch user code call current program counter is stacked at the location of the current stack pointer. instruction execution begins at user patch code. reset peripherals rst asserts reset for 512 clock cycles. the cpu is not reset by this command. synonymous with the cpu reset instruction. no operation nop nop performs no operation and can be used as a null command. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68332 52 mc68332ts/d 5 time processor unit the time processor unit (tpu) provides optimum performance in controlling time-related activity. the tpu contains a dedicated execution unit, a tri-level prioritized scheduler, data storage ram, dual-time bases, and microcode rom. the tpu controls 16 independent, orthogonal channels, each with an as- sociated i/o pin, and is capable of performing any microcoded time function. each channel contains dedicated hardware that allows input or output events to occur simultaneously on all channels. figure 12 tpu block diagram 5.1 mc68332 and mc68332a time functions the following paragraphs describe factory-programmed time functions implemented in standard and enhanced standard tpu microcode rom. a complete description of the functions is beyond the scope of this summary. refer to using the tpu function library and tpu emulation mode (tpupn00/d) as well as other tpu programming notes for more information about specific functions. 5.1.1 discrete input/output (dio) when a pin is used as a discrete input, a parameter indicates the current input level and the previous 15 levels of a pin. bit 15, the most significant bit of the parameter, indicates the most recent state. bit 14 indicates the next most recent state, and so on. the programmer can choose one of the three fol- lowing conditions to update the parameter: 1) when a transition occurs, 2) when the cpu makes a re- quest, or 3) when a rate specified in another parameter is matched. when a pin is used as a discrete output, it is set high or low only upon request by the cpu. t2clk pins service requests data f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68332 motorola mc68332ts/d 53 5.1.2 input capture/input transition counter (itc) any channel of the tpu can capture the value of a specified tcr upon the occurrence of each transition or specified number of transitions, and then generate an interrupt request to notify the cpu. a channel can perform input captures continually, or a channel can detect a single transition or specified number of transitions, then cease channel activity until reinitialization. after each transition or specified number of transitions, the channel can generate a link to a sequential block of up to eight channels. the user specifies a starting channel of the block and the number of channels within the block. the generation of links depends on the mode of operation. in addition, after each transition or specified number of tran- sitions, one byte of the parameter ram (at an address specified by channel parameter) can be incre- mented and used as a flag to notify another channel of a transition. 5.1.3 output compare (oc) the output compare function generates a rising edge, falling edge, or a toggle of the previous edge in one of three ways: 1. immediately upon cpu initiation, thereby generating a pulse with a length equal to a program- mable delay time. 2. at a programmable delay time from a user-specified time. 3. continuously. upon receiving a link from a channel, oc references, without cpu interaction, a specifiable period and calculates an offset: offset = period * ratio where ratio is a parameter supplied by the user. this algorithm generates a 50% duty-cycle continuous square wave with each high/low time equal to the calculated offset. due to offset calculation, there is an initial link time before continuous pulse generation begins. 5.1.4 pulse-width modulation (pwm) the tpu can generate a pulse-width modulation waveform with any duty cycle from zero to 100% (with- in the resolution and latency capability of the tpu). to define the pwm, the cpu provides one param- eter that indicates the period and another parameter that indicates the high time. updates to one or both of these parameters can direct the waveform change to take effect immediately, or coherently beginning at the next low-to-high transition of the pin. 5.1.5 synchronized pulse-width modulation (spwm) the tpu generates a pwm waveform in which the cpu can change the period and/or high time at any time. when synchronized to a time function on a second channel, the synchronized pwm low-to-high transitions have a time relationship to transitions on the second channel. 5.1.6 period measurement with additional transition detect (pma) this function and the following function are used primarily in toothed-wheel speed-sensing applications, such as monitoring rotational speed of an engine. the period measurement with additional transition detect function allows for a special-purpose 23-bit period measurement. it can detect the occurrence of an additional transition (caused by an extra tooth on the sensed wheel) indicated by a period measure- ment that is less than a programmable ratio of the previous period measurement. once detected, this condition can be counted and compared to a programmable number of additional transitions detected before tcr2 is reset to $ffff. alternatively, a byte at an address specified by a channel parameter can be read and used as a flag. a nonzero value of the flag indicates that tcr2 is to be reset to $ffff once the next additional transition is detected. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68332 54 mc68332ts/d 5.1.7 period measurement with missing transition detect (pmm) period measurement with missing transition detect allows a special-purpose 23-bit period measure- ment. it detects the occurrence of a missing transition (caused by a missing tooth on the sensed wheel), indicated by a period measurement that is greater than a programmable ratio of the previous period measurement. once detected, this condition can be counted and compared to a programmable number of additional transitions detected before tcr2 is reset to $ffff. in addition, one byte at an address specified by a channel parameter can be read and used as a flag. a nonzero value of the flag indicates that tcr2 is to be reset to $ffff once the next missing transition is detected. 5.1.8 position-synchronized pulse generator (psp) any channel of the tpu can generate an output transition or pulse, which is a projection in time based on a reference period previously calculated on another channel. both tcrs are used in this algorithm: tcr1 is internally clocked, and tcr2 is clocked by a position indicator in the user's device. an example of a tcr2 clock source is a sensor that detects special teeth on the flywheel of an automobile using pma or pmm. the teeth are placed at known degrees of engine rotation; hence, tcr2 is a coarse rep- resentation of engine degrees, i.e., each count represents some number of degrees. up to 15 position-synchronized pulse generator function channels can operate with a single input ref- erence channel executing a pma or pmm input function. the input channel measures and stores the time period between the flywheel teeth and resets tcr2 when the engine reaches a reference position. the output channel uses the period calculated by the input channel to project output transitions at spe- cific engine degrees. because the flywheel teeth might be 30 or more degrees apart, a fractional multi- plication operation resolves down to the desired degrees. two modes of operation allow pulse length to be determined either by angular position or by time. 5.1.9 stepper motor (sm) the stepper motor control algorithm provides for linear acceleration and deceleration control of a step- per motor with a programmable number of step rates of up to 14. any group of channels, up to eight, can be programmed to generate the control logic necessary to drive a stepper motor. the time period between steps (p) is defined as: p(r) = k1 e k2 * r where r is the current step rate (1e14), and k1 and k2 are supplied as parameters. after providing the desired step position in a 16-bit parameter, the cpu issues a step request. next, the tpu steps the motor to the desired position through an acceleration/deceleration profile defined by pa- rameters. the parameter indicating the desired position can be changed by the cpu while the tpu is stepping the motor. this algorithm changes the control state every time a new step command is re- ceived. a 16-bit parameter initialized by the cpu for each channel defines the output state of the associated pin. the bit pattern written by the cpu defines the method of stepping, such as full stepping or half step- ping. with each transition, the 16-bit parameter rotates one bit. the period of each transition is defined by the programmed step rate. 5.1.10 period/pulse-width accumulator (ppwa) the period/pulse-width accumulator algorithm accumulates a 16-bit or 24-bit sum of either the period or the pulse width of an input signal over a programmable number of periods or pulses (from 1 to 255). after an accumulation period, the algorithm can generate a link to a sequential block of up to eight chan- nels. the user specifies a starting channel of the block and number of channels within the block. gen- eration of links depends on the mode of operation. any channel can be used to measure an accumulated number of periods of an input signal. a maximum of 24 bits can be used for the accumu- f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68332 motorola mc68332ts/d 55 lation parameter. from 1 to 255 period measurements can be made and summed with the previous measurement(s) before the tpu interrupts the cpu, allowing instantaneous or average frequency mea- surement, and the latest complete accumulation (over the programmed number of periods). the pulse width (high-time portion) of an input signal can be measured (up to 24 bits) and added to a previous measurement over a programmable number of periods (1 to 255). this provides an instanta- neous or average pulse-width measurement capability, allowing the latest complete accumulation (over the specified number of periods) to always be available in a parameter. by using the output compare function in conjunction with ppwa, an output signal can be generated that is proportional to a specified input signal. the ratio of the input and output frequency is programmable. one or more output signals with different frequencies, yet proportional and synchronized to a single input signal, can be generated on separate channels. 5.1.11 quadrature decode (qdec) the quadrature decode function uses two channels to decode a pair of out-of-phase signals in order to present the cpu with directional information and a position value. it is particularly suitable for use with slotted encoders employed in motor control. the function derives full resolution from the encoder sig- nals and provides a 16-bit position counter with rollover/under indication via an interrupt. the counter in parameter ram is updated when a valid transition is detected on either one of the two inputs. the counter is incremented or decremented depending on the lead/lag relationship of the two signals at the time of servicing the transition. the user can read or write the counter at any time. the counter is free running, overflowing to $0000 or underflowing to $ffff depending on direction. the qdec function also provides a time stamp referenced to tcr1 for every valid signal edge and the abil- ity for the host cpu to obtain the latest tcr1 value. this feature allows position interpolation by the host cpu between counts at very slow count rates. 5.2 mc68332g time functions the following paragraphs describe factory-programmed time functions implemented in the motion-con- trol microcode rom. a complete description of the functions is beyond the scope of this summary. re- fer to using the tpu function library and tpu emulation mode (tpupn00/d) for more information about specific functions. 5.2.1 table stepper motor (tsm) the tsm function provides for acceleration and deceleration control of a stepper motor with a program- mable number of step rates up to 58. tsm uses a table in pram, rather than an algorithm, to define the stepper motor acceleration profile, allowing the user to fully define the profile. in addition, a slew rate parameter allows fine control of the terminal running speed of the motor independent of the acceleration table. the cpu need only write a desired position, and the tpu accelerates, slews, and decelerates the motor to the required position. full and half step support is provided for two-phase motors. in addi- tion, a slew rate parameter allows fine control of the terminal running speed of the motor independent of the acceleration table. 5.2.2 new input capture/transition counter (nitc) any channel of the tpu can capture the value of a specified tcr or any specified location in parameter ram upon the occurrence of each transition or specified number of transitions, and then generate an interrupt request to notify the bus master. the times of the most recent two transitions are maintained in parameter ram. a channel can perform input captures continually, or a channel can detect a single transition or specified number of transitions, ceasing channel activity until reinitialization. after each transition or specified number of transitions, the channel can generate a link to other channels. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68332 56 mc68332ts/d 5.2.3 queued output match (qom) qom can generate single or multiple output match events from a table of offsets in parameter ram. loop modes allow complex pulse trains to be generated once, a specified number of times, or continu- ously. the function can be triggered by a link from another tpu channel. in addition, the reference time for the sequence of matches can be obtained from another channel. qom can generate pulse-width modulated waveforms, including waveforms with high times of 0% or 100%. qom also allows a tpu channel to be used as a discrete output pin. 5.2.4 programmable time accumulator (pta) pta accumulates a 32-bit sum of the total high time, low time, or period of an input signal over a pro- grammable number of periods or pulses. the accumulation can start on a rising or falling edge. after the specified number of periods or pulses, the pta generates an interrupt request and optionally gen- erates links to other channels. from 1 to 255 period measurements can be made and summed with the previous measurement(s) be- fore the tpu interrupts the cpu, providing instantaneous or average frequency measurement capabil- ity, and the latest complete accumulation (over the programmed number of periods). 5.2.5 multichannel pulse width modulation (mcpwm) mcpwm generates pulse-width modulated outputs with full 0% to 100% duty cycle range independent of other tpu activity. this capability requires two tpu channels plus an external gate for one pwm channel. (a simple one-channel pwm capability is supported by the qom function.) multiple pwms generated by mcpwm have two types of high time alignment: edge aligned and center aligned. edge aligned mode uses n + 1 tpu channels for n pwms; center aligned mode uses 2n + 1 channels. center aligned mode allows a user defined ?dead time? to be specified so that two pwms can be used to drive an h-bridge without destructive current spikes. this feature is important for motor con- trol applications. 5.2.6 fast quadrature decode (fqd) fqd is a position feedback function for motor control. it decodes the two signals from a slotted encoder to provide the cpu with a 16-bit free running position counter. fqd incorporates a speed switch which disables one of the channels at high speed, allowing faster signals to be decoded. a time stamp is pro- vided on every counter update to allow position interpolation and better velocity determination at low speed or when low resolution encoders are used. the third index channel provided by some encoders is handled by the ictc function. 5.2.7 universal asynchronous receiver/transmitter (uart) the uart function uses one or two tpu channels to provide asynchronous communications. data word length is programmable from 1 to 14 bits. the function supports detection or generation of even, odd, and no parity. baud rate is freely programmable and can be higher than 100 kbaud. eight bidirec- tional uart channels running in excess of 9600 baud could be implemented on the tpu. 5.2.8 brushless motor commutation (comm) this function generates the phase commutation signals for a variety of brushless motors, including three-phase brushless direct current. it derives the commutation state directly from the position decod- ed in fqd, thus eliminating the need for hall effect sensors. the state sequence is implemented as a user-configurable state machine, thus providing a flexible ap- proach with other general applications. a cpu offset parameter is provided to allow all the switching angles to be advanced or retarded on the fly by the cpu. this feature is useful for torque maintenance at high speeds. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68332 motorola mc68332ts/d 57 5.2.9 frequency measurement (fqm) fqm counts the number of input pulses to a tpu channel during a user-defined window period. the function has single shot and continuous modes. no pulses are lost between sample windows in contin- uous mode. the user selects whether to detect pulses on the rising or falling edge. this function is in- tended for high speed measurement; measurement of slow pulses with noise rejection can be made with pta. 5.2.10 hall effect decode (halld) this function decodes the sensor signals from a brushless motor, along with a direction input from the cpu, into a state number. the function supports two- or three-sensor decoding. the decoded state number is written into a comm channel, which outputs the required commutation drive signals. in ad- dition to brushless motor applications, the function can have more general applications, such as decod- ing option switches. 5.3 programmer's model the tpu control register address map occupies 512 bytes. the access column in the tpu address map below indicates which registers are accessible only at the supervisor privilege level and which can be assigned to either the supervisor or user privilege level, according to the value of the supv bit in the tpumcr. y = m111, where m represents the logic state of the module mapping (mm) bit in the simcr. table 22 tpu address map access address 15 8 7 0 s $yffe00 tpu module configuration register (tpumcr) s $yffe02 test configuration register (tcr) s $yffe04 development support control register (dscr) s $yffe06 development support status register (dssr) s $yffe08 tpu interrupt configuration register (ticr) s $yffe0a channel interrupt enable register (cier) s $yffe0c channel function selection register 0 (cfsr0) s $yffe0e channel function selection register 1 (cfsr1) s $yffe10 channel function selection register 2 (cfsr2) s $yffe12 channel function selection register 3 (cfsr3) s/u $yffe14 host sequence register 0 (hsqr0) s/u $yffe16 host sequence register 1 (hsqr1) s/u $yffe18 host service request register 0 (hsrr0) s/u $yffe1a host service request register 1 (hsrr1) s $yffe1c channel priority register 0 (cpr0) s $yffe1e channel priority register 1 (cpr1) s $yffe20 channel interrupt status register (cisr) s $yffe22 link register (lr) s $yffe24 service grant latch register (sglr) s $yffe26 decoded channel number register (dcnr) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68332 58 mc68332ts/d 5.4 parameter ram parameter ram occupies 256 bytes at the top of the tpu module address map. channel parameters are organized as 128 16-bit words. however, only 100 words are actually implemented. the parameter ram address map shows how parameter words are organized in memory. ?= not implemented y = m111, where m represents the logic state of the mm bit in the simcr. 5.5 tpu registers the tpu memory map contains three groups of registers: system configuration registers channel control and status registers development support and test verification registers 5.5.1 system configuration registers stop ? stop bit 0 = tpu operating normally 1 = internal clocks shut down table 23 tpu parameter ram address map channel base parameter address number address 01234567 0 $yffff## 00 02 04 06 08 0a ? ? 1 $yffff## 10 12 14 16 18 1a ? ? 2 $yffff## 20 22 24 26 28 2a ? ? 3 $yffff## 30 32 34 36 38 3a ? ? 4 $yffff## 40 42 44 46 48 4a ? ? 5 $yffff## 50 52 54 56 58 5a ? ? 6 $yffff## 60 62 64 66 68 6a ? ? 7 $yffff## 70 72 74 76 78 7a ? ? 8 $yffff## 80 82 84 86 88 8a ? ? 9 $yffff## 90 92 94 96 98 9a ? ? 10 $yffff## a0 a2 a4 a6 a8 aa ? ? 11 $yffff## b0 b2 b4 b6 b8 ba ? ? 12 $yffff## c0 c2 c4 c6 c8 ca ? ? 13 $yffff## d0 d2 d4 d6 d8 da ? ? 14 $yffff## e0 e2 e4 e6 e8 ea ec ee 15 $yffff## f0 f2 f4 f6 f8 fa fc fe tpumcr ? tpu module configuration register $yffe00 15 14 13 12 11 10 9 8 7 6 5 4 3 0 stop tcr1p tcr2p emu t2cg stf supv psck 0 0 iarb reset: 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68332 motorola mc68332ts/d 59 tcr1p ? timer count register 1 prescaler control tcr1 is clocked from the output of a prescaler. the prescaler's input is the internal tpu system clock divided by either 4 or 32, depending on the value of the psck bit. the prescaler divides this input by 1, 2, 4, or 8. channels using tcr1 have the capability to resolve down to the tpu system clock divided by 4. tcr2p ? timer count register 2 prescaler control tcr2 is clocked from the output of a prescaler. if t2cg = 0, the input to the tcr2 prescaler is the ex- ternal tcr2 clock source. if t2cg = 1, the input is the tpu system clock divided by eight. the tcr2p field specifies the value of the prescaler: 1, 2, 4, or 8. channels using tcr2 have the capability to re- solve down to the tpu system clock divided by 8. the following table is a summary of prescaler output. psck = 0 psck = 1 tcr1 prescaler divide by number of clocks rate at 16 mhz number of clocks rate at 16 mhz 00 1 32 2 ms 4 250 ns 01 2 64 4 ms 8 500 ns 10 4 128 8 ms 16 1 ms 11 8 256 16 ms 32 2 ms tcr2 prescaler divide by internal clock divided by external clock divided by 00181 012162 104324 118648 tcr1 015 psck mux ? 4 div4 clock ? 32 div32 clock tcr1 prescaler 00 ? 1 01 ? 2 10 ? 4 11 ? 8 system clock 1 ?div4 0 ?div32 prescaler ctl block 1 prescaler ctl block 2 digital filter external tcr2 pin tcr2 (t2cg control bit) 0 ?a 1 ?b 015 a b mux control tcr2 prescaler 00 ? 1 01 ? 2 10 ? 4 11 ? 8 int clk /8 synchronizer f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68332 60 mc68332ts/d emu ? emulation control in emulation mode, the tpu executes microinstructions from mcu tpuram exclusively. access to the tpuram module through the imb by a host is blocked, and the tpuram module is dedicated for use by the tpu. after reset, this bit can be written only once. 0 = tpu and tpuram not in emulation mode 1 = tpu and tpuram in emulation mode t2cg ? tcr2 clock/gate control when the t2cg bit is set, the external tcr2 pin functions as a gate of the div8 clock (the tpu system clock divided by 8). in this case, when the external tcr2 pin is low, the div8 clock is blocked, prevent- ing it from incrementing tcr2. when the external tcr2 pin is high, tcr2 is incremented at the fre- quency of the div8 clock. when t2cg is cleared, an external clock from the tcr2 pin, which has been synchronized and fed through a digital filter, increments tcr2. 0 = tcr2 pin used as clock source for tcr2 1 = tcr2 pin used as gate of div8 clock for tcr2 stf ? stop flag 0 = tpu operating 1 = tpu stopped (stop bit has been asserted) supv ? supervisor data space 0 = assignable registers are unrestricted (fc2 is ignored) 1 = assignable registers are restricted (fc2 is decoded) psck ? prescaler clock 0 = system clock/32 is input to tcr1 prescaler 1 = system clock/4 is input to tcr1 prescaler iarb ? interrupt arbitration identification number the iarb field is used to arbitrate between simultaneous interrupt requests of the same priority. each module that can generate interrupt requests must be assigned a unique, non-zero iarb field value. re- fer to the 3.8 interrupts for more information. cirl ? channel interrupt request level the interrupt request level for all channels is specified by this 3-bit encoded field. level seven for this field indicates a nonmaskable interrupt; level zero indicates that all channel interrupts are disabled. cibv ? channel interrupt base vector the tpu is assigned 16 unique interrupt vector numbers, one vector number for each channel. the cibv field specifies the most significant nibble of all 16 tpu channel interrupt vector numbers. the low- er nibble of the tpu interrupt vector number is determined by the channel number on which the interrupt occurs. ticr ? tpu interrupt configuration register $yffe08 15 11 10 8 7 4 3 0 not used cirl cibv not used reset: 0 0 0 0 0 0 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68332 motorola mc68332ts/d 61 5.5.2 channel control registers ch[15:0] ? channel interrupt enable/disable 0 = channel interrupts disabled 1 = channel interrupts enabled ch[15:0] ? channel interrupt status bit 0 = channel interrupt not asserted 1 = channel interrupt asserted channel[15:0] ? encoded time function for each channel encoded 4-bit fields in the channel function select registers specify one of 16 time functions to be exe- cuted on the corresponding channel. cier ? channel interrupt enable register $yffe0a 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 ch 15 ch 14 ch 13 ch 12 ch 11 ch 10 ch 9 ch 8 ch 7 ch 6 ch 5 ch 4 ch 3 ch 2 ch 1 ch 0 reset: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 cisr ?channel interrupt status register $yffe20 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 ch 15 ch 14 ch 13 ch 12 ch 11 ch 10 ch 9 ch 8 ch 7 ch 6 ch 5 ch 4 ch 3 ch 2 ch 1 ch 0 reset: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 cfsr0 ?channel function select register 0 $yffe0c 15 12 11 8 7 4 3 0 channel15 channel14 channel13 channel12 reset: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 cfsr1 ?channel function select register 1 $yffe0e 15 12 11 8 7 4 3 0 channel11 channel10 channel9 channel8 reset: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 cfsr2 ?channel function select register 2 $yffe10 15 12 11 8 7 4 3 0 channel7 channel6 channel5 channel4 reset: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 cfsr3 ?channel function select register 3 $yffe12 15 12 11 8 7 4 3 0 channel3 channel2 channel1 channel0 reset: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68332 62 mc68332ts/d ch[15:0] ? encoded host sequence the host sequence field selects the mode of operation for the time function selected on a given channel. the meaning of the host sequence bits depends on the time function specified. ch[15:0] ? encoded type of host service the host service request field selects the type of host service request for the time function selected on a given channel. the meaning of the host service request bits depends on the time function specified. a host service request field cleared to %00 signals the host that service is completed by the microengine on that channel. the host can request service on a channel by writing the corresponding host service request field to one of three nonzero states. the cpu should monitor the host service request register until the tpu clears the service request to %00 before the cpu changes any parameters or issues a new service request to the channel. ch[15:0] ? encoded one of three channel priority levels hsqr0 ? host sequence register 0 $yffe14 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 ch 15 ch 14 ch 13 ch 12 ch 11 ch 10 ch 9 ch 8 reset: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 hsqr1 ?host sequence register 1 $yffe16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 ch 7 ch 6 ch 5 ch 4 ch 3 ch 2 ch 1 ch 0 reset: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 hsrr0 ?host service request register 0 $yffe18 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 ch 15 ch 14 ch 13 ch 12 ch 11 ch 10 ch 9 ch 8 reset: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 hsrr1 ?host service request register 1 $yffe1a 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 ch 7 ch 6 ch 5 ch 4 ch 3 ch 2 ch 1 ch 0 reset: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 cpr0 ?channel priority register 0 $yffe1c 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 ch 15 ch 14 ch13 ch 12 ch 11 ch 10 ch 9 ch 8 reset: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 cpr1 ?channel priority register 1 $yffe1e 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 ch 7 ch 6 ch 5 ch 4 ch 3 ch 2 ch 1 ch 0 reset: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68332 motorola mc68332ts/d 63 5.5.3 development support and test registers these registers are used for custom microcode development or for factory test. describing the use of the registers is beyond the scope of this technical summary. register names and addresses are given for reference only. please refer to the tpu reference manual (tpurm/ad) for more information. dscr ? development support control register $yffe04 dssr ? development support status register $yffe06 lr ? link register $yffe22 sglr ? service grant latch register $yffe24 dcnr ? decoded channel number register $yffe26 tcr ? test configuration register $yffe02 the tcr is used for factory test of the mcu. chx[1:0] service guaranteed time slots 00 disabled ? 01 low 4 out of 7 10 middle 2 out of 7 11 high 1 out of 7 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68332 64 mc68332ts/d 6 queued serial module the qsm contains two serial interfaces, the queued serial peripheral interface (qspi) and the serial communication interface (sci). figure 13 qsm block diagram 6.1 overview the qspi provides easy peripheral expansion or interprocessor communication through a full-duplex, synchronous, three-line bus: data in, data out, and a serial clock. four programmable peripheral chip- select pins provide addressability for up to 16 peripheral devices. a self-contained ram queue allows up to 16 serial transfers of 8 to 16 bits each, or transmission of a 256-bit data stream without cpu in- tervention. a special wraparound mode supports continuous sampling of a serial peripheral, with auto- matic qspi ram updating, which makes the interface to a/d converters more efficient. the sci provides a standard nonreturn to zero (nrz) mark/space format. it operates in either full- or half-duplex mode. there are separate transmitter and receiver enable bits and dual data buffers. a modulus-type baud rate generator provides rates from 64 to 524 kbaud with a 16.78-mhz system clock, or 110 to 655 kbaud with a 20.97-mhz system clock. word length of either 8 or 9 bits is software select- able. optional parity generation and detection provide either even or odd parity check capability. ad- vanced error detection circuitry catches glitches of up to 1/16 of a bit time in duration. wakeup functions allow the cpu to run uninterrupted until meaningful data is available. an address map of the qsm is shown below. qspi interface logic sci miso/pqs0 mosi/pqs1 sck/pqs2 pcs0/ss /pqs3 pcs1/pqs4 pcs2/pqs5 pcs3/pqs6 txd/pqs7 rxd port qs qsm block imb f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68332 motorola mc68332ts/d 65 6.2 address map the access column in the qsm address map below indicates which registers are accessible only at the supervisor privilege level and which can be assigned to either the supervisor or user privilege level, according to the value of the supv bit in the qsmcr. y = m111, where m is the logic state of the mm bit in the simcr. table 24 qsm address map access address 15 8 7 0 s $yffc00 qsm module configuration (qsmcr) s $yffc02 qsm test (qtest) s $yffc04 qsm interrupt level (qilr) qsm interrupt vector (qivr) s/u $yffc06 not used s/u $yffc08 sci control 0 (sccr0) s/u $yffc0a sci control 1 (sccr1) s/u $yffc0c sci status (scsr) s/u $yffc0e sci data (scdr) s/u $yffc10 not used s/u $yffc12 not used s/u $yffc14 not used pqs data (portqs) s/u $yffc16 pqs pin assignment (pqspar) pqs data direction (ddrqs) s/u $yffc18 spi control 0 (spcr0) s/u $yffc1a spi control 1 (spcr1) s/u $yffc1c spi control 2 (spcr2) s/u $yffc1e spi control 3 (spcr3) spi status (spsr) s/u $yffc20e $yffcff not used s/u $yffd00e $yffd1f receive ram (rr[0:f]) s/u $yffd20e $yffd3f transmit ram (tr[0:f]) s/u $yffd40e $yffd4f command ram (cr[0:f]) f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68332 66 mc68332ts/d 6.3 pin function the following table is a summary of the functions of the qsm pins when they are not configured for gen- eral-purpose i/o. the qsm data direction register (ddrqs) designates each pin except rxd as an in- put or output. 6.4 qsm registers qsm registers are divided into four categories: qsm global registers, qsm pin control registers, qspi submodule registers, and sci submodule registers. the qspi and sci registers are defined in separate sections below. writes to unimplemented register bits have no meaning or effect, and reads from unim- plemented bits always return a logic zero value. the module mapping bit of the sim configuration register (simcr) defines the most significant bit (addr23) of the address, shown in each register figure as y (y = $7 or $f). this bit, concatenated with the rest of the address given, forms the absolute address of each register. refer to the sim section of this technical summary for more information about how the state of mm affects the system. 6.4.1 global registers the qsm global registers contain system parameters used by both the qspi and the sci submodules. these registers contain the bits and fields used to configure the qsm. the qsmcr contains parameters for the qsm/cpu/intermodule bus (imb) interface. stop ? stop enable 0 = normal qsm clock operation 1 = qsm clock operation stopped stop places the qsm in a low-power state by disabling the system clock in most parts of the module. the qsmcr is the only register guaranteed to be readable while stop is asserted. the qspi ram is not readable. however, writes to ram or any register are guaranteed to be valid while stop is assert- ed. stop can be negated by the cpu and by reset. pin mode pin function miso master serial data input to qspi qspi pins slave serial data output from qspi mosi master serial data output from qspi slave serial data input to qspi sck master clock output from qspi slave clock input to qspi pcs0/ss master input: assertion causes mode fault output: selects peripherals slave input: selects the qspi pcs[3:1] master output: selects peripherals slave none sci pins txd transmit serial data output from sci rxd receive serial data input to sci qsmcr ? qsm configuration register $yffc00 15 14 13 12 11 10 9 8 7 6 5 4 3 0 stop frz1 frz0 0 0 0 0 0 supv 0 0 0 iarb reset: 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68332 motorola mc68332ts/d 67 the system software must stop each submodule before asserting stop to avoid complications at re- start and to avoid data corruption. the sci submodule receiver and transmitter should be disabled, and the operation should be verified for completion before asserting stop. the qspi submodule should be stopped by asserting the halt bit in spcr3 and by asserting stop after the halta flag is set. frz1 ? freeze 1 0 = ignore the freeze signal on the imb 1 = halt the qspi (on a transfer boundary) frz1 determines what action is taken by the qspi when the freeze signal of the imb is asserted. freeze is asserted whenever the cpu enters the background mode. frz0 ? freeze 0 reserved bits [12:8] ? not implemented supv ? supervisor/unrestricted 0 = user access 1 = supervisor access supv defines the assignable qsm registers as either supervisor-only data space or unrestricted data space. iarb ? interrupt arbitration identification number the iarb field is used to arbitrate between simultaneous interrupt requests of the same priority. each module that can generate interrupt requests must be assigned a unique, non-zero iarb field value. re- fer to 3.8 interrupts for more information. qtest ? qsm test register $yffc02 qtest is used during factory testing of the qsm. accesses to qtest must be made while the mcu is in test mode. qilr determines the priority level of interrupts requested by the qsm and the vector used when an in- terrupt is acknowledged. ilqspi ? interrupt level for qspi ilqspi determines the priority of qspi interrupts. this field must be given a value between $0 (inter- rupts disabled) to $7 (highest priority). ilsci ? interrupt level of sci ilsci determines the priority of sci interrupts. this field must be given a value between $0 (interrupts disabled) to $7 (highest priority). if ilqspi and ilsci are the same nonzero value, and both submodules simultaneously request inter- rupt service, qspi has priority. qilr ? qsm interrupt levels register $yffc04 15 14 13 11 10 8 7 0 0 0 ilqspi ilsci qivr reset: 0 0 0 0 0 0 0 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68332 68 mc68332ts/d at reset, qivr is initialized to $0f, which corresponds to the uninitialized interrupt vector in the excep- tion table. this vector is selected until qivr is written. a user-defined vector ($40e$ff) should be writ- ten to qivr during qsm initialization. after initialization, qivr determines which two vectors in the exception vector table are to be used for qsm interrupts. the qspi and sci submodules have separate interrupt vectors adjacent to each other. both submodules use the same interrupt vector with the least significant bit (lsb) determined by the submodule causing the interrupt. the value of intv0 used during an interrupt-acknowledge cycle is supplied by the qsm. during an in- terrupt-acknowledge cycle, intv[7:1] are driven on data[7:1] imb lines. data0 is negated for an sci interrupt and asserted for a qspi interrupt. writes to intv0 have no meaning or effect. reads of intv0 return a value of one. 6.4.2 pin control registers the qsm uses nine pins, eight of which form a parallel port (portqs) on the mcu. although these pins are used by the serial subsystems, any pin can alternately be assigned as general-purpose i/o on a pin-by-pin basis. pins used for general-purpose i/o must not be assigned to the qspi by register pqspar. to avoid driving incorrect data, the first byte to be output must be written before ddrqs is configured. ddrqs must then be written to determine the direction of data flow and to output the value contained in register portqs. subsequent data for output is written to portqs. portqs latches i/o data. writes drive pins defined as outputs. reads return data present on the pins. to avoid driving undefined data, first write a byte to portqs, then configure ddrqs. clearing a bit in the pqspar assigns the corresponding pin to general-purpose i/o; setting a bit as- signs the pin to the qspi. the pqspar does not affect operation of the sci. qivr ? qsm interrupt vector register $yffc05 15 8 7 0 qilr intv reset: 0 0 0 0 1 1 1 1 portqs ?port qs data register $yffc14 15 8 7 6 5 4 3 2 1 0 not used pqs7 pqs6 pqs5 pqs4 pqs3 pqs2 pqs1 pqs0 reset: 0 0 0 0 0 0 0 0 pqspar ?port qs pin assignment register $yffc16 ddrqs ?port qs data direction register $yffc17 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 pqspa6 pqspa5 pqspa4 pqspa3 0 pqspa1 pqspa0 ddqs7 ddqs6 ddqs5 ddqs4 ddqs3 ddqs2 ddqs1 ddqs0 reset: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68332 motorola mc68332ts/d 69 notes: 1. pqs2 is a digital i/o pin unless the spi is enabled (spe in spcr1 set), in which case it becomes spi serial clock sck. 2. pqs7 is a digital i/o pin unless the sci transmitter is enabled (te in sccr1 = 1), in which case it becomes sci serial output txd. ddrqs determines whether pins are inputs or outputs. clearing a bit makes the corresponding pin an input; setting a bit makes the pin an output. ddrqs affects both qspi function and i/o function. table 25 qspar pin assignments pqspar field pqspar bit pin function pqspa0 0 pqs0 1 miso pqspa1 0 pqs1 1 mosi pqspa2 0 pqs2 1 1 sck pqspa3 0 pqs3 1 pcs0/ss pqspa4 0 pqs4 1 pcs1 pqspa5 0 pqs5 1 pcs2 pqspa6 0 pqs6 1 pcs3 pqspa7 0 pqs7 2 1 txd f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68332 70 mc68332ts/d notes: 1. pqs2 is a digital i/o pin unless the spi is enabled (spe in spcr1 set), in which case it becomes spi serial clock sck. 2. pqs7 is a digital i/o pin unless the sci transmitter is enabled (te in sccr1 = 1), in which case it be- comes sci serial output txd. ddrqs determines the direction of the txd pin only when the sci transmitter is disabled. when the sci transmitter is enabled, the txd pin is an output. table 26 effect of ddrqs on qsm pin function qsm pin mode ddrqs bit bit state pin function miso master ddq0 0 serial data input to qspi 1 disables data input slave 0 disables data output 1 serial data output from qspi mosi master ddq1 0 disables data output 1 serial data output from qspi slave 0 serial data input to qspi 1 disables data input sck 1 master ddq2 0 disables clock output 1 clock output from qspi slave 0 clock input to qspi 1 disables clock input pcs0/ss master ddq3 0 assertion causes mode fault 1 chip-select output slave 0 qspi slave select input 1 disables select input pcs[3:1] master ddq[4:6] 0 disables chip-select output 1 chip-select output slave 0 inactive 1 inactive txd 2 transmit ddq7 x serial data output from sci rxd receive none na serial data input to sci f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68332 motorola mc68332ts/d 71 6.5 qspi submodule the qspi submodule communicates with external devices through a synchronous serial bus. the qspi is fully compatible with the serial peripheral interface (spi) systems found on other motorola products. a block diagram of the qspi is shown below. figure 14 qspi block diagram 6.5.1 qspi pins seven pins are associated with the qspi. when not needed for a qspi application, they can be con- figured as general-purpose i/o pins. the pcs0/ss pin can function as a peripheral chip select output, slave select input, or general-purpose i/o. refer to the following table for qspi input and output pins and their functions. qspi block control registers end queue pointer queue pointer status register delay counter comparator programmable logic array 80-byte qspi ram chip select command done 4 4 3 baud rate generator pcs [3:1] pcs0/ss miso mosi sck m s m s 8/16-bit shift register rx/tx data register msb lsb 4 queue control block control logic address register 4 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68332 72 mc68332ts/d 6.5.2 qspi registers the programmer's model for the qspi submodule consists of the qsm global and pin control registers, four qspi control registers, one status register, and the 80-byte qspi ram. the cpu can read and write to registers and ram. the four control registers must be initialized before the qspi is enabled to ensure defined operation. spcr1 should be written last because it contains qspi enable bit spe. asserting this bit starts the qspi. the qspi control registers are reset to a de- fined state and can then be changed by the cpu. reset values are shown below each register. refer to the following memory map of the qspi. writing a different value into any control register except spcr2 while the qspi is enabled disrupts op- eration. spcr2 is buffered to prevent disruption of the current serial transfer. after completion of the current serial transfer, the new spcr2 values become effective. writing the same value into any control register except spcr2 while the qspi is enabled has no effect on qspi operation. rewriting newqp in spcr2 causes execution to restart at the designated location. spcr0 contains parameters for configuring the qspi before it is enabled. the cpu can read and write this register. the qsm has read-only access. pin names mnemonics mode function master in slave out miso master slave serial data input to qspi serial data output from qspi master out slave in mosi master slave serial data output from qspi serial data input to qspi serial clock sck master slave clock output from qspi clock input to qspi peripheral chip selects pcs[3:1] master select peripherals peripheral chip select slave select pcs0 ss master master slave selects peripheral causes mode fault initiates serial transfer address name usage $yffc18 spcr0 qspi control register 0 $yffc1a spcr1 qspi control register 1 $yffc1c spcr2 qspi control register 2 $yffc1e spcr3 qspi control register 3 $yffc1f spsr qspi status register $yffd00 ram qspi receive data (16 words) $yffd20 ram qspi transmit data (16 words) $yffd40 ram qspi command control (8 words) spcr0 ? qspi control register 0 $yffc18 15 14 13 10 9 8 7 0 mstr womq bits cpol cpha spbr reset: 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68332 motorola mc68332ts/d 73 mstr ? master/slave mode select 0 = qspi is a slave device and only responds to externally generated serial data. 1 = qspi is system master and can initiate transmission to external spi devices. mstr configures the qspi for either master or slave mode operation. this bit is cleared on reset and may only be written by the cpu. womq ? wired-or mode for qspi pins 0 = outputs have normal mos drivers. 1 = pins designated for output by ddrqs have open-drain drivers. womq allows the wired-or function to be used on qspi pins, regardless of whether they are used as general-purpose outputs or as qspi outputs. womq affects the qspi pins regardless of whether the qspi is enabled or disabled. bits ? bits per transfer in master mode, when bitse in a command is set, the bits field determines the number of data bits transferred. when bitse is cleared, eight bits are transferred. reserved values default to eight bits. bitse is not used in slave mode. the following table shows the number of bits per transfer. cpol ? clock polarity 0 = the inactive state value of sck is logic level zero. 1 = the inactive state value of sck is logic level one. cpol is used to determine the inactive state value of the serial clock (sck). it is used with cpha to produce a desired clock/data relationship between master and slave devices. cpha ? clock phase 0 = data is captured on the leading edge of sck and changed on the following edge of sck. 1 = data is changed on the leading edge of sck and captured on the following edge of sck. cpha determines which edge of sck causes data to change and which edge causes data to be cap- tured. cpha is used with cpol to produce a desired clock/data relationship between master and slave devices. cpha is set at reset. spbr ? serial clock baud rate the qspi uses a modulus counter to derive sck baud rate from the mcu system clock. baud rate is selected by writing a value from 2 to 255 into the spbr field. the following equation determines the bits bits per transfer 0000 16 0001 reserved 0010 reserved 0011 reserved 0100 reserved 0101 reserved 0110 reserved 0111 reserved 1000 8 1001 9 1010 10 1011 11 1100 12 1101 13 1110 14 1111 15 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68332 74 mc68332ts/d sck baud rate: sck baud rate = system clock/(2spbr) or spbr = system clock/(2sck)(baud rate desired) where spbr equals {2, 3, 4,..., 255} giving spbr a value of zero or one disables the baud rate generator. sck is disabled and assumes its inactive state value. no serial transfers occur. at reset, baud rate is initialized to one eighth of the sys- tem clock frequency. spcr1 contains parameters for configuring the qspi before it is enabled. the cpu can read and write this register, but the qsm has read access only, except for spe, which is automatically cleared by the qspi after completing all serial transfers, or when a mode fault occurs. spe ? qspi enable 0 = qspi is disabled. qspi pins can be used for general-purpose i/o. 1 = qspi is enabled. pins allocated by pqspar are controlled by the qspi. dsckl ? delay before sck when the dsck bit in command ram is set, this field determines the length of delay from pcs valid to sck transition. pcs can be any of the four peripheral chip-select pins. the following equation deter- mines the actual delay before sck: pcs to sck delay = [dsckl/system clock] where dsckl equals {1, 2, 3,..., 127}. when the dsck value of a queue entry equals zero, then dsckl is not used. instead, the pcs valid- to-sck transition is one-half sck period. dtl ? length of delay after transfer when the dt bit in command ram is set, this field determines the length of delay after serial transfer. the following equation is used to calculate the delay: delay after transfer = [(32dtl)/system clock] where dtl equals {1, 2, 3,..., 255}. a zero value for dtl causes a delay-after-transfer value of 8192/system clock. if dt equals zero, a standard delay is inserted. standard delay after transfer = [17/system clock] delay after transfer can be used to provide a peripheral deselect interval. a delay can also be inserted between consecutive transfers to allow serial a/d converters to complete conversion. spcr1 ? qspi control register 1 $yffc1a 15 14 8 7 0 spe dsckl dtl reset: 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68332 motorola mc68332ts/d 75 spcr2 contains qspi configuration parameters. the cpu can read and write this register; the qsm has read access only. writes to spcr2 are buffered. a write to spcr2 that changes a bit value while the qspi is operating is ineffective on the current serial transfer, but becomes effective on the next se- rial transfer. reads of spcr2 return the current value of the register, not of the buffer. spifie ? spi finished interrupt enable 0 = qspi interrupts disabled 1 = qspi interrupts enabled spifie enables the qspi to generate a cpu interrupt upon assertion of the status flag spif. wren ? wrap enable 0 = wraparound mode disabled 1 = wraparound mode enabled wren enables or disables wraparound mode. wrto ? wrap to when wraparound mode is enabled, after the end of queue has been reached, wrto determines which address the qspi executes. bit 12 ? not implemented endqp ? ending queue pointer this field contains the last qspi queue address. bits [7:4] ? not implemented newqp ? new queue pointer value this field contains the first qspi queue address. spcr3 contains qspi configuration parameters. the cpu can read and write spcr3, but the qsm has read-only access. bits [15:11] ? not implemented loopq ? qspi loop mode 0 = feedback path disabled 1 = feedback path enabled loopq controls feedback on the data serializer for testing. hmie ? halta and modf interrupt enable 0 = halta and modf interrupts disabled 1 = halta and modf interrupts enabled hmie controls cpu interrupts caused by the halta status flag or the modf status flag in spsr. spcr2 ? qspi control register 2 $yffc1c 15 14 13 12 11 8 7 6 5 4 3 0 spifie wren wrto 0 endqp 0 0 0 0 newqp reset: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 spcr3 ?qspi control register 3 $yffc1e 15 14 13 12 11 10 9 8 7 0 0 0 0 0 0 loopq hmie halt spsr reset: 0 0 0 0 0 0 0 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68332 76 mc68332ts/d halt ? halt 0 = halt not enabled 1 = halt enabled when halt is asserted, the qspi stops on a queue boundary. it is in a defined state from which it can later be restarted. spsr contains qspi status information. only the qspi can assert the bits in this register. the cpu reads this register to obtain status information and writes it to clear status flags. spif ? qspi finished flag 0 = qspi not finished 1 = qspi finished spif is set after execution of the command at the address in endqp. modf ? mode fault flag 0 = normal operation 1 = another spi node requested to become the network spi master while the qspi was enabled in master mode (ss input taken low). the qspi asserts modf when the qspi is the serial master (mstr = 1) and the ss input pin is negat- ed by an external driver. halta ? halt acknowledge flag 0 = qspi not halted 1 = qspi halted halta is asserted when the qspi halts in response to cpu assertion of halt. bit 4 ? not implemented cptqp ? completed queue pointer cptqp points to the last command executed. it is updated when the current command is complete. when the first command in a queue is executing, cptqp contains either the reset value ($0) or a point- er to the last command completed in the previous queue. 6.5.3 qspi ram the qspi contains an 80-byte block of dual-access static ram that is used by both the qspi and the cpu. the ram is divided into three segments: receive data, transmit data, and command control data. receive data is information received from a serial device external to the mcu. transmit data is infor- mation stored by the cpu for transmission to an external peripheral. command control data is used to perform the transfer. refer to the following illustration of the organization of the ram. spsr ? qspi status register $yffc1f 15 8 7 6 5 4 3 0 spcr3 spif modf halta 0 cptqp reset: 0 0 0 0 0 0 0 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68332 motorola mc68332ts/d 77 figure 15 qspi ram once the cpu has set up the queue of qspi commands and enabled the qspi, the qspi can operate independently of the cpu. the qspi executes all of the commands in its queue, sets a flag indicating that it is finished, and then either interrupts the cpu or waits for cpu intervention. it is possible to ex- ecute a queue of commands repeatedly without cpu intervention. rr[0:f] ? receive data ram $yffd00 data received by the qspi is stored in this segment. the cpu reads this segment to retrieve data from the qspi. data stored in receive ram is right-justified. unused bits in a receive queue entry are set to zero by the qspi upon completion of the individual queue entry. the cpu can access the data using byte, word, or long-word addressing. the cptqp value in spsr shows which queue entries have been executed. the cpu uses this infor- mation to determine which locations in receive ram contain valid data before reading them. tr[0:f] ? transmit data ram $yffd20 data that is to be transmitted by the qspi is stored in this segment. the cpu usually writes one word of data into this segment for each queue command to be executed. information to be transmitted must be written to transmit data ram in a right-justified format. the qspi cannot modify information in the transmit data ram. the qspi copies the information to its data serial- izer for transmission. information remains in transmit ram until overwritten. *the pcs0 bit represents the dual-function pcs0/ss . cr[0:f] ? command ram $yffd40 7 6543210 cont bitse dt dsck pcs3 pcs2 pcs1 pcs0* ?????? cont bitse dt dsck pcs3 pcs2 pcs1 pcs0* command control peripheral chip select qspi ram map receive ram transmit ram d00 d1e d20 d3e word d40 d4f command ram byte word rr0 rr1 rr2 rrd rre rrf tr0 tr1 tr2 trd tre trf cr0 cr1 cr2 crd cre crf f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68332 78 mc68332ts/d command ram is used by the qspi when in master mode. the cpu writes one byte of control infor- mation to this segment for each qspi command to be executed. the qspi cannot modify information in command ram. command ram consists of 16 bytes. each byte is divided into two fields. the peripheral chip-select field enables peripherals for transfer. the command control field provides transfer options. a maximum of 16 commands can be in the queue. queue execution by the qspi proceeds from the address in newqp through the address in endqp. (both of these fields are in spcr2.) cont ? continue 0 = control of chip selects returned to portqs after transfer is complete. 1 = peripheral chip selects remain asserted after transfer is complete. bitse ? bits per transfer enable 0 = 8 bits 1 = number of bits set in bits field of spcr0 dt ? delay after transfer the qspi provides a variable delay at the end of serial transfer to facilitate the interface with peripherals that have a latency requirement. the delay between transfers is determined by the spcr1 dtl field. dsck ? pcs to sck delay 0 = pcs valid to sck transition is one-half sck. 1 = spcr1 dsckl field specifies delay from pcs valid to sck. pcs[3:0] ? peripheral chip select use peripheral chip-select bits to select an external device for serial data transfer. more than one pe- ripheral chip select can be activated at a time, and more than one peripheral chip can be connected to each pcs pin, provided that proper fanout is observed. ss ? slave mode select initiates slave mode serial transfer. if ss is taken low when the qspi is in master mode, a mode fault will be generated. 6.5.4 operating modes the qspi operates in either master or slave mode. master mode is used when the mcu originates data transfers. slave mode is used when an external device initiates serial transfers to the mcu through the qspi. switching between the modes is controlled by mstr in spcr0. before entering either mode, appropriate qsm and qspi registers must be properly initialized. in master mode, the qspi executes a queue of commands defined by control bits in each command ram queue entry. chip-select pins are activated, data is transmitted from transmit ram and received into receive ram. in slave mode, operation proceeds in response to ss pin activation by an external bus master. opera- tion is similar to master mode, but no peripheral chip selects are generated, and the number of bits transferred is controlled in a different manner. when the qspi is selected, it automatically executes the next queue transfer to exchange data with the external device correctly. although the qspi inherently supports multimaster operation, no special arbitration mechanism is pro- vided. a mode fault flag (modf) indicates a request for spi master arbitration. system software must provide arbitration. note that unlike previous spi systems, mstr is not cleared by a mode fault being set, nor are the qspi pin output drivers disabled. the qspi and associated output drivers must be dis- abled by clearing spe in spcr1. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68332 motorola mc68332ts/d 79 6.6 sci submodule the sci submodule is used to communicate with external devices through an asynchronous serial bus. the sci is fully compatible with the sci systems found on other motorola mcus, such as the m68hc11 and m68hc05 families. 6.6.1 sci pins there are two unidirectional pins associated with the sci. the sci controls the transmit data (txd) pin when enabled, whereas the receive data (rxd) pin remains a dedicated input pin to the sci. txd is available as a general-purpose i/o pin when the sci transmitter is disabled. when used for i/o, txd can be configured either as input or output, as determined by qsm register ddrqs. the following table shows sci pins and their functions. 6.6.2 sci registers the sci programming model includes qsm global and pin control registers, and four sci registers. there are two sci control registers, one status register, and one data register. all registers can be read or written at any time by the cpu. changing the value of sci control bits during a transfer operation may disrupt operation. before chang- ing register values, allow the transmitter to complete the current transfer, then disable the receiver and transmitter. status flags in the scsr may be cleared at any time. sccr0 contains a baud rate selection parameter. baud rate must be set before the sci is enabled. the cpu can read and write this register at any time. bits [15:13] ? not implemented scbr ? baud rate sci baud rate is programmed by writing a 13-bit value to br. the baud rate is derived from the mcu system clock by a modulus counter. the sci receiver operates asynchronously. an internal clock is necessary to synchronize with an in- coming data stream. the sci baud rate generator produces a receiver sampling clock with a frequency 16 times that of the expected baud rate of the incoming data. the sci determines the position of bit boundaries from transitions within the received waveform, and adjusts sampling points to the proper po- sitions within the bit period. receiver sampling rate is always 16 times the frequency of the sci baud rate, which is calculated as follows: sci baud rate = system clock/(32scbr) or scbr = system clock(32sck)(baud rate desired) where scbr is in the range {1, 2, 3, ..., 8191} pin names mnemonics mode function receive data rxd receiver disabled receiver enabled not used serial data input to sci transmit data txd transmitter disabled transmitter enabled general-purpose i/o serial data output from sci sccr0 ? sci control register 0 $yffc08 15 14 13 12 0 0 0 0 scbr reset: 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68332 80 mc68332ts/d writing a value of zero to scbr disables the baud rate generator. the following table lists the scbr settings for standard and maximum baud rates using 16.78-mhz and 20.97-mhz system clocks. sccr1 contains sci configuration parameters. the cpu can read and write this register at any time. the sci can modify rwu in some circumstances. in general, interrupts enabled by these control bits are cleared by reading scsr, then reading (receiver status bits) or writing (transmitter status bits) scdr. bit 15 ? not implemented loops ? loop mode 0 = normal sci operation, no looping, feedback path disabled 1 = test sci operation, looping, feedback path enabled loops controls a feedback path on the data serial shifter. when loop mode is enabled, sci transmitter output is fed back into the receive serial shifter. txd is asserted (idle line). both transmitter and receiver must be enabled before entering loop mode. woms ? wired-or mode for sci pins 0 = if configured as an output, txd is a normal cmos output. 1 = if configured as an output, txd is an open-drain output. woms determines whether the txd pin is an open-drain output or a normal cmos output. this bit is used only when txd is an output. if txd is used as a general-purpose input pin, woms has no effect. ilt ? idle-line detect type 0 = short idle-line detect (start count on first one) 1 = long idle-line detect (start count on first one after stop bit(s)) pt ? parity type 0 = even parity 1 = odd parity when parity is enabled, pt determines whether parity is even or odd for both the receiver and the trans- mitter. table 27 sci baud rates nominal baud rate actual rate with 16.78-mhz clock scbr value actual rate with 20.97-mhz clock scbr value 64* 64.0 $1fff ? ? 110 110.0 $129e 110.0 $1745 300 299.9 $06d4 300.1 $0888 600 599.9 $036a 600.1 $0444 1200 1199.7 $0165 1200.3 $0222 2400 2405.0 $00da 2400.6 $0111 4800 4810.0 $006d 4783.6 $0089 9600 9532.5 $0037 9637.6 $0044 19200 19418.1 $0016 19275.3 $0022 38400 37449.1 $000e 38550.6 $0011 76800 74898.3 $0007 72817.8 $0009 maximum rate 524288.0 $0001 655360.0 $0001 sccr1 ? sci control register 1 $yffc0a 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 loops woms ilt pt pe m wake tie tcie rie ilie te re rwu sbk reset: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68332 motorola mc68332ts/d 81 pe ? parity enable 0 = sci parity disabled 1 = sci parity enabled pe determines whether parity is enabled or disabled for both the receiver and the transmitter. if the re- ceived parity bit is not correct, the sci sets the pf error flag in scsr. when pe is set, the most significant bit (msb) of the data field is used for the parity function, which re- sults in either seven or eight bits of user data, depending on the condition of m bit. the following table lists the available choices. m ? mode select 0 = sci frame: 1 start bit, 8 data bits, 1 stop bit (10 bits total) 1 = sci frame: 1 start bit, 9 data bits, 1 stop bit (11 bits total) wake ? wakeup by address mark 0 = sci receiver awakened by idle-line detection 1 = sci receiver awakened by address mark (last bit set) tie ? transmit interrupt enable 0 = sci tdre interrupts inhibited 1 = sci tdre interrupts enabled tcie ? transmit complete interrupt enable 0 = sci tc interrupts inhibited 1 = sci tc interrupts enabled rie ? receiver interrupt enable 0 = sci rdrf interrupt inhibited 1 = sci rdrf interrupt enabled ilie ? idle-line interrupt enable 0 = sci idle interrupts inhibited 1 = sci idle interrupts enabled te ? transmitter enable 0 = sci transmitter disabled (txd pin may be used as i/o) 1 = sci transmitter enabled (txd pin dedicated to sci transmitter) the transmitter retains control of the txd pin until completion of any character transfer that was in progress when te is cleared. re ? receiver enable 0 = sci receiver disabled (status bits inhibited) 1 = sci receiver enabled rwu ? receiver wakeup 0 = normal receiver operation (received data recognized) 1 = wakeup mode enabled (received data ignored until awakened) setting rwu enables the wakeup function, which allows the sci to ignore received data until awakened by either an idle line or address mark (as determined by wake). when in wakeup mode, the receiver status flags are not set, and interrupts are inhibited. this bit is cleared automatically (returned to normal mode) when the receiver is awakened. m pe result 0 0 8 data bits 0 1 7 data bits, 1 parity bit 1 0 9 data bits 1 1 8 data bits, 1 parity bit f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68332 82 mc68332ts/d sbk ? send break 0 = normal operation 1 = break frame(s) transmitted after completion of current frame sbk provides the ability to transmit a break code from the sci. if the sci is transmitting when sbk is set, it will transmit continuous frames of zeros after it completes the current frame, until sbk is cleared. if sbk is toggled (one to zero in less than one frame interval), the transmitter sends only one or two break frames before reverting to idle line or beginning to send data. scsr contains flags that show sci operational conditions. these flags can be cleared either by hard- ware or by a special acknowledgment sequence. the sequence consists of scsr read with flags set, followed by scdr read (write in the case of tdre and tc). a long-word read can consecutively access both scsr and scdr. this action clears receive status flag bits that were set at the time of the read, but does not clear tdre or tc flags. if an internal sci signal for setting a status bit comes after the cpu has read the asserted status bits, but before the cpu has written or read register scdr, the newly set status bit is not cleared. scsr must be read again with the bit set. also, scdr must be written or read before the status bit is cleared. reading either byte of scsr causes all 16 bits to be accessed. any status bit already set in either byte will be cleared on a subsequent read or write of register scdr. tdre ? transmit data register empty flag 0 = register tdr still contains data to be sent to the transmit serial shifter. 1 = a new character can now be written to register tdr. tdre is set when the byte in register tdr is transferred to the transmit serial shifter. if tdre is zero, transfer has not occurred and a write to tdr will overwrite the previous value. new data is not trans- mitted if tdr is written without first clearing tdre. tc ? transmit complete flag 0 = sci transmitter is busy 1 = sci transmitter is idle tc is set when the transmitter finishes shifting out all data, queued preambles (mark/idle line), or queued breaks (logic zero). the interrupt can be cleared by reading scsr when tc is set and then by writing the transmit data register (tdr) of scdr. rdrf ? receive data register full flag 0 = register rdr is empty or contains previously read data. 1 = register rdr contains new data. rdrf is set when the content of the receive serial shifter is transferred to the rdr. if one or more errors are detected in the received word, flag(s) nf, fe, and/or pf are set within the same clock cycle. raf ? receiver active flag 0 = sci receiver is idle 1 = sci receiver is busy raf indicates whether the sci receiver is busy. it is set when the receiver detects a possible start bit and is cleared when the chosen type of idle line is detected. raf can be used to reduce collisions in systems with multiple masters. scsr ? sci status register $yffc0c 15 9 8 7 6 5 4 3 2 1 0 not used tdre tc rdrf raf idle or nf fe pf reset: 1 1 0 0 0 0 0 0 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68332 motorola mc68332ts/d 83 idle ? idle-line detected flag 0 = sci receiver did not detect an idle-line condition. 1 = sci receiver detected an idle-line condition. idle is disabled when rwu in sccr1 is set. idle is set when the sci receiver detects the idle-line condition specified by ilt in sccr1. if cleared, idle will not set again until after rdrf is set. rdrf is set when a break is received, so that a subsequent idle line can be detected. or ? overrun error flag 0 = rdrf is cleared before new data arrives. 1 = rdrf is not cleared before new data arrives. or is set when a new byte is ready to be transferred from the receive serial shifter to the rdr, and rdrf is still set. data transfer is inhibited until or is cleared. previous data in rdr remains valid, but data received during overrun condition (including the byte that set or) is lost. nf ? noise error flag 0 = no noise detected on the received data 1 = noise occurred on the received data nf is set when the sci receiver detects noise on a valid start bit, on any data bit, or on a stop bit. it is not set by noise on the idle line or on invalid start bits. each bit is sampled three times. if none of the three samples are the same logic level, the majority value is used for the received data value, and nf is set. nf is not set until an entire frame is received and rdrf is set. fe ? framing error flag 0 = no framing error on the received data. 1 = framing error or break occurred on the received data. fe is set when the sci receiver detects a zero where a stop bit was to have occurred. fe is not set until the entire frame is received and rdrf is set. a break can also cause fe to be set. it is possible to miss a framing error if rxd happens to be at logic level one at the time the stop bit is expected. pf ? parity error flag 0 = no parity error on the received data 1 = parity error occurred on the received data pf is set when the sci receiver detects a parity error. pf is not set until the entire frame is received and rdrf is set. scdr contains two data registers at the same address. receive data register (rdr) is a read-only reg- ister that contains data received by the sci. the data comes into the receive serial shifter and is trans- ferred to rdr. transmit data register (tdr) is a write-only register that contains data to be transmitted. the data is first written to tdr, then transferred to the transmit serial shifter, where additional format bits are added before transmission. r[7:0]/t[7:0] contain either the first eight data bits received when scdr is read, or the first eight data bits to be transmitted when scdr is written. r8/t8 are used when the sci is configured for 9-bit operation. when it is configured for 8-bit operation, they have no meaning or effect. scdr ? sci data register $yffc0e 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0 0 0 0 0 0 0 r8/t8 r7/t7 r6/t6 r5/t5 r4/t4 r3/t3 r2/t2 r1/t1 r0/t0 reset: 0 0 0 0 0 0 0 u u u u u u u u u f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68332 84 mc68332ts/d 7 standby ram with tpu emulation ram the tpuram module contains a 2-kbyte array of fast (two bus cycle) static ram, which is especially useful for system stacks and variable storage. alternately, it can be used by the tpu as emulation ram for new timer algorithms. 7.1 overview the tpuram can be mapped to any 4-kbyte boundary in the address map, but must not overlap the module control registers. (overlap makes the registers inaccessible.) data can be read or written in bytes, word, or long words. tpuram responds to both program and data space accesses. data can be read or written in bytes, words, or long words. the tpuram is powered by v dd in normal operation. during power-down, the tpuram contents are maintained by power on standby voltage pin v stby . power switching between sources is automatic. access to the tpuram array is controlled by the rasp field in trammcr. this field can be encoded so that tpuram responds to both program and data space accesses. this allows code to be executed from tpuram, and permits the use of program counter relative addressing mode for operand fetches from the array. an address map of the tpuram control registers follows. all tpuram control registers are located in supervisor data space. y = m111, where m is the logic state of the mm bit in the simcr. 7.2 tpuram register block there are three tpuram control registers: the ram module configuration register (trammcr), the ram test register (tramtst), and the ram array base address registers (trambar). there is an 8-byte minimum register block size for the module. unimplemented register addresses are read as zeros, and writes have no effect. 7.3 tpuram registers tstop ?stop control 0 = ram array operates normally. 1 = ram array enters low-power stop mode. this bit controls whether the ram array is in stop mode or normal operation. reset state is zero, for normal operation. in stop mode, the array retains its contents, but cannot be read or written by the cpu. table 28 tpuram control register address map access address 15 8 7 0 s $yffb00 tpuram module configuration register (trammcr) s $yffb02 tpuram test register (tramtst) s $yffb04 tpuram base address register (trambar) $yffb06e $yffb3f not used trammcr ?tpuram module configuration register $yffb00 15 14 13 12 11 10 9 8 7 0 stop 0 0 0 0 0 0 rasp not used reset: 0 0 0 0 0 0 0 1 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68332 motorola mc68332ts/d 85 rasp ? ram array space field 0 = tpuram array is placed in unrestricted space 1 = tpuram array is placed in supervisor space tramtst ? tpuram test register $yffb02 tramtst is used for factory testing of the tpuram module. addr[23:11] ? ram array base address these bits specify address lines addr[23:11] of the base address of the ram array when enabled. ramds ? ram array disable 0 = ram array is enabled 1 = ram array is disabled the ram array is disabled by internal logic after a master reset. writing a valid base address to the ram array base address field (bits [15:3]) automatically clears ramds, enabling the ram array. 7.4 tpuram operation there are six tpuram operating modes, as follows: 1. the tpuram module is in normal mode when powered by v dd . the array can be accessed by byte, word, or long word. a byte or aligned word (high-order byte is at an even address) ac- cess only takes one bus cycle or two system clocks. a long word or misaligned word access requires two bus cycles. 2. standby mode is intended to preserve tpuram contents when v dd is removed. tpuram contents are maintained by v stby . circuitry within the tpuram module switches to the higher of v dd or v stby with no loss of data. when tpuram is powered by v stby , access to the array is not guaranteed. 3. reset mode allows the cpu to complete the current bus cycle before resetting. when a syn- chronous reset occurs while a byte or word tpuram access is in progress, the access will be completed. if reset occurs during the first word access of a long-word operation, only the first word access will be completed. if reset occurs during the second word access of a long word operation, the entire access will be completed. data being read from or written to the ram may be corrupted by asynchronous reset. 4. test mode functions in conjunction with the sim test functions. test mode is used during factory test of the mcu. 5. writing the stop bit of trammcr causes the tpuram module to enter stop mode. the tpuram array is disabled (which allows external logic to decode tpuram addresses, if nec- essary), but all data is retained. if v dd falls below v stby during stop mode, internal circuitry switches to v stby , as in standby mode. stop mode is exited by clearing the stop bit. 6. the tpuram array may be used to emulate the microcode rom in the tpu module. this pro- vides a means of developing custom tpu code. the tpu selects tpu emulation mode. while in tpu emulation mode, the access timing of the tpuram module matches the timing of the tpu microinstruction rom to ensure accurate emulation. normal accesses via the imb are in- hibited and the control registers have no effect, allowing external ram to emulate the tpuram at the same addresses. trambar ? tpuram base address and status register $yffb04 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 addr 23 addr 22 addr 21 addr 20 addr 19 addr 18 addr 17 addr 16 addr 15 addr 14 addr 13 addr 12 addr 11 not used ramds reset: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
motorola mc68332 86 mc68332ts/d 8 summary of changes this is a partial revision. most of the publication remains the same, but the following changes were made to improve it. typographical errors that do not affect content are not annotated. this document has also been reformatted for use on the web. pages 2-3 new ordering information included. page 6 new block diagram drawn. page 7 new 132-pin assignment diagram drawn. page 8 new 144-pin assignment diagram drawn. page 9 new address map drawn. pages 10-14 added signal description section. pages 15-47 expanded and revised sim section. made all register diagrams and bit mnemonics consistent. incorporated new information concerning the system clock, resets, in- terrupts, and chip-selects circuits. page 48-56 expanded and revised cpu section. made all register diagrams and bit mnemon- ics consistent. revised instruction set summary information. page 57-70 expanded and revised tpu section. made all register diagrams and bit mnemonics consistent. revised time functions information to include both mc68332a and mc68332g microcode rom applications. page 71-92 expanded and revised qsm section. made all register diagrams and bit mnemon- ics consistent. added information concerning spi and sci operation. page 93-95 revised standby ram with tpu emulation ram section. made all register dia- grams and bit mnemonics consistent. f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68332 motorola mc68332ts/d 87 f r e e s c a l e s e m i c o n d u c t o r , i freescale semiconductor, inc. f o r m o r e i n f o r m a t i o n o n t h i s p r o d u c t , g o t o : w w w . f r e e s c a l e . c o m n c . . .
mc68332ts/d freescale semiconductor, i freescale semiconductor, inc. for more information on this product, go to: www.freescale.com nc...


▲Up To Search▲   

 
Price & Availability of MC68332ACFC16

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X